diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17ee0f5ea5..dfff7b39c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,6 +79,8 @@ jobs: test-services: name: Services Tests runs-on: ubuntu-20.04 + env: + RUSTFLAGS: -Dwarnings -Aunreachable-code -Aunused-assignments -Adead-code steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 diff --git a/services/autorust/codegen/examples/gen_mgmt.rs b/services/autorust/codegen/examples/gen_mgmt.rs index 05c381e0b2..09580fba84 100644 --- a/services/autorust/codegen/examples/gen_mgmt.rs +++ b/services/autorust/codegen/examples/gen_mgmt.rs @@ -22,6 +22,7 @@ const SKIP_SERVICES: &[&str] = &[ const SKIP_SERVICE_TAGS: &[(&str, &str)] = &[ ("applicationinsights", "package-preview-2020-06"), // defines operation `list` multiple times + ("applicationinsights", "package-2021-11-01"), // duplicate Operations_List https://github.com/Azure/azure-rest-api-specs/issues/17215 ("analysisservices", "package-2017-08"), ("authorization", "package-2020-10-01-preview"), ("authorization", "package-2018-05-01-preview"), @@ -182,6 +183,7 @@ const BOX_PROPERTIES: &[(&str, &str, &str)] = &[ ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2021-02-01-preview/dataprotection.json", "InnerError", "embeddedInnerError"), ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2021-06-01-preview/dataprotection.json", "InnerError", "embeddedInnerError"), ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2021-10-01-preview/dataprotection.json", "InnerError", "embeddedInnerError"), + ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2021-12-01-preview/dataprotection.json", "InnerError", "embeddedInnerError"), // hardwaresecuritymodels ("../../../azure-rest-api-specs/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2018-10-31-preview/dedicatedhsm.json", "Error", "innererror"), // logic diff --git a/services/autorust/codegen/examples/gen_svc.rs b/services/autorust/codegen/examples/gen_svc.rs index 8e72a23164..d0c9cb688d 100644 --- a/services/autorust/codegen/examples/gen_svc.rs +++ b/services/autorust/codegen/examples/gen_svc.rs @@ -70,10 +70,15 @@ const BOX_PROPERTIES: &[(&str, &str, &str)] = &[ "innerError", ), ( - "../../../azure-rest-api-specs/specification/mixedreality/data-plane/Microsoft.MixedReality/preview/2021-01-01-preview/mr-arr.json", + "../../../azure-rest-api-specs/specification/mixedreality/data-plane/Microsoft.MixedReality/preview/2021-01-01-preview/mr-arr.json", "error", "innerError", ), + ( + "../../../azure-rest-api-specs/specification/mixedreality/data-plane/Microsoft.MixedReality/preview/0.3-preview.0/mr-aoa.json", + "InnerError", + "innererror", + ), // confidentialledger ( "../../../azure-rest-api-specs/specification/confidentialledger/data-plane/Microsoft.ConfidentialLedger/preview/0.1-preview/common.json", @@ -145,6 +150,11 @@ const BOX_PROPERTIES: &[(&str, &str, &str)] = &[ "InnerError", "innererror" ), + ( + "../../../azure-rest-api-specs/specification/digitaltwins/data-plane/Microsoft.DigitalTwins/preview/2021-06-30-preview/digitaltwins.json", + "InnerError", + "innererror" + ), ]; pub type Result = std::result::Result; diff --git a/services/mgmt/adp/Cargo.toml b/services/mgmt/adp/Cargo.toml index ed3267513a..bbbb4f4835 100644 --- a/services/mgmt/adp/Cargo.toml +++ b/services/mgmt/adp/Cargo.toml @@ -25,3 +25,4 @@ enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] "package-2020-07-01-preview" = [] "package-2021-02-01-preview" = [] +"package-2021-11-01-preview" = [] diff --git a/services/mgmt/adp/src/lib.rs b/services/mgmt/adp/src/lib.rs index 2e7ece4191..11d3045472 100644 --- a/services/mgmt/adp/src/lib.rs +++ b/services/mgmt/adp/src/lib.rs @@ -11,3 +11,7 @@ pub use package_2020_07_01_preview::{models, operations, operations::Client, ope pub mod package_2021_02_01_preview; #[cfg(all(feature = "package-2021-02-01-preview", not(feature = "no-default-version")))] pub use package_2021_02_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-11-01-preview")] +pub mod package_2021_11_01_preview; +#[cfg(all(feature = "package-2021-11-01-preview", not(feature = "no-default-version")))] +pub use package_2021_11_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/adp/src/package_2021_11_01_preview/mod.rs b/services/mgmt/adp/src/package_2021_11_01_preview/mod.rs new file mode 100644 index 0000000000..75f67dfde9 --- /dev/null +++ b/services/mgmt/adp/src/package_2021_11_01_preview/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-11-01-preview"; diff --git a/services/mgmt/adp/src/package_2021_11_01_preview/models.rs b/services/mgmt/adp/src/package_2021_11_01_preview/models.rs new file mode 100644 index 0000000000..be56bf2529 --- /dev/null +++ b/services/mgmt/adp/src/package_2021_11_01_preview/models.rs @@ -0,0 +1,324 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Account { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountCheckNameAvailabilityParameters { + pub name: String, + #[serde(rename = "type")] + pub type_: account_check_name_availability_parameters::Type, +} +pub mod account_check_name_availability_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "Microsoft.AutonomousDevelopmentPlatform/accounts")] + MicrosoftAutonomousDevelopmentPlatformAccounts, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountPatch { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountProperties { + #[serde(rename = "accountId", default, skip_serializing_if = "Option::is_none")] + pub account_id: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod account_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Failed, + Canceled, + Accepted, + Provisioning, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityResult { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +pub mod check_name_availability_result { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Reason { + Invalid, + AlreadyExists, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataPool { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataPoolBaseProperties { + #[serde(rename = "dataPoolId", default, skip_serializing_if = "Option::is_none")] + pub data_pool_id: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +pub mod data_pool_base_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Failed, + Canceled, + Accepted, + Provisioning, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataPoolEncryption { + #[serde(rename = "keyVaultUri")] + pub key_vault_uri: String, + #[serde(rename = "keyName")] + pub key_name: String, + #[serde(rename = "keyVersion", default, skip_serializing_if = "Option::is_none")] + pub key_version: Option, + #[serde(rename = "userAssignedIdentity")] + pub user_assigned_identity: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataPoolList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataPoolLocation { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "storageSku", default, skip_serializing_if = "Option::is_none")] + pub storage_sku: Option, + #[serde(rename = "storageAccountCount", default, skip_serializing_if = "Option::is_none")] + pub storage_account_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataPoolPatch { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataPoolProperties { + #[serde(flatten)] + pub data_pool_base_properties: DataPoolBaseProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationLogSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationMetricAvailability { + #[serde(rename = "timeGrain", default, skip_serializing_if = "Option::is_none")] + pub time_grain: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationMetricSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[serde(rename = "enableRegionalMdmAccount", default, skip_serializing_if = "Option::is_none")] + pub enable_regional_mdm_account: Option, + #[serde(rename = "sourceMdmAccount", default, skip_serializing_if = "Option::is_none")] + pub source_mdm_account: Option, + #[serde(rename = "sourceMdmNamespace", default, skip_serializing_if = "Option::is_none")] + pub source_mdm_namespace: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub availabilities: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationProperties { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationServiceSpecification { + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Tags {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageSku { + pub name: storage_sku::Name, +} +pub mod storage_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Standard_GRS")] + StandardGrs, + #[serde(rename = "Standard_Ragrs")] + StandardRagrs, + #[serde(rename = "Standard_ZRS")] + StandardZrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "Premium_ZRS")] + PremiumZrs, + #[serde(rename = "Standard_Gzrs")] + StandardGzrs, + #[serde(rename = "Standard_Ragzrs")] + StandardRagzrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/adp/src/package_2021_11_01_preview/operations.rs b/services/mgmt/adp/src/package_2021_11_01_preview/operations.rs new file mode 100644 index 0000000000..124d0f2f8f --- /dev/null +++ b/services/mgmt/adp/src/package_2021_11_01_preview/operations.rs @@ -0,0 +1,1382 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn accounts(&self) -> accounts::Client { + accounts::Client(self.clone()) + } + pub fn data_pools(&self) -> data_pools::Client { + data_pools::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Accounts_CheckNameAvailability(#[from] accounts::check_name_availability::Error), + #[error(transparent)] + Accounts_List(#[from] accounts::list::Error), + #[error(transparent)] + Accounts_ListByResourceGroup(#[from] accounts::list_by_resource_group::Error), + #[error(transparent)] + Accounts_Get(#[from] accounts::get::Error), + #[error(transparent)] + Accounts_CreateOrUpdate(#[from] accounts::create_or_update::Error), + #[error(transparent)] + Accounts_Update(#[from] accounts::update::Error), + #[error(transparent)] + Accounts_Delete(#[from] accounts::delete::Error), + #[error(transparent)] + DataPools_List(#[from] data_pools::list::Error), + #[error(transparent)] + DataPools_Get(#[from] data_pools::get::Error), + #[error(transparent)] + DataPools_CreateOrUpdate(#[from] data_pools::create_or_update::Error), + #[error(transparent)] + DataPools_Update(#[from] data_pools::update::Error), + #[error(transparent)] + DataPools_Delete(#[from] data_pools::delete::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.AutonomousDevelopmentPlatform/operations", + self.client.endpoint(), + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod accounts { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + subscription_id: impl Into, + parameters: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + parameters: None, + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + parameters: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) parameters: models::AccountCheckNameAvailabilityParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AutonomousDevelopmentPlatform/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccountList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccountList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Account = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Account), + Created201(models::Account), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Account = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Account = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Account), + Created201(models::Account), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Account = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Account = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_pools { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + data_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + data_pool_name: data_pool_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + data_pool_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + data_pool_name: data_pool_name.into(), + parameters: None, + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + data_pool_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + data_pool_name: data_pool_name.into(), + parameters: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + data_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + data_pool_name: data_pool_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}/dataPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataPoolList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) data_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}/dataPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.data_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataPool), + Created201(models::DataPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) data_pool_name: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}/dataPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.data_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataPool), + Created201(models::DataPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) data_pool_name: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}/dataPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.data_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) data_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{}/dataPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.data_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/alertsmanagement/Cargo.toml b/services/mgmt/alertsmanagement/Cargo.toml index e9c54ee7e5..46fed4e032 100644 --- a/services/mgmt/alertsmanagement/Cargo.toml +++ b/services/mgmt/alertsmanagement/Cargo.toml @@ -19,10 +19,11 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2021-04-only", "enable_reqwest"] +default = ["package-2021-08", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-08" = [] "package-preview-2021-08" = [] "package-2021-04-only" = [] "package-preview-2021-01" = [] diff --git a/services/mgmt/alertsmanagement/src/lib.rs b/services/mgmt/alertsmanagement/src/lib.rs index 38aa58b3df..c026d19e43 100644 --- a/services/mgmt/alertsmanagement/src/lib.rs +++ b/services/mgmt/alertsmanagement/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-08")] +pub mod package_2021_08; +#[cfg(all(feature = "package-2021-08", not(feature = "no-default-version")))] +pub use package_2021_08::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-preview-2021-08")] pub mod package_preview_2021_08; #[cfg(all(feature = "package-preview-2021-08", not(feature = "no-default-version")))] diff --git a/services/mgmt/alertsmanagement/src/package_2021_08/mod.rs b/services/mgmt/alertsmanagement/src/package_2021_08/mod.rs new file mode 100644 index 0000000000..c85236d3f4 --- /dev/null +++ b/services/mgmt/alertsmanagement/src/package_2021_08/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-08-08"; diff --git a/services/mgmt/alertsmanagement/src/package_2021_08/models.rs b/services/mgmt/alertsmanagement/src/package_2021_08/models.rs new file mode 100644 index 0000000000..0fa0b891f0 --- /dev/null +++ b/services/mgmt/alertsmanagement/src/package_2021_08/models.rs @@ -0,0 +1,590 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Action { + #[serde(rename = "actionType")] + pub action_type: action::ActionType, +} +pub mod action { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + AddActionGroups, + RemoveAllActionGroups, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddActionGroups { + #[serde(flatten)] + pub action: Action, + #[serde(rename = "actionGroupIds")] + pub action_group_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertProcessingRule { + #[serde(flatten)] + pub managed_resource: ManagedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertProcessingRuleProperties { + pub scopes: Scopes, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conditions: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schedule: Option, + pub actions: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertProcessingRulesList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Condition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub field: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operator: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +pub mod condition { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Field { + Severity, + MonitorService, + MonitorCondition, + SignalType, + TargetResourceType, + TargetResource, + TargetResourceGroup, + AlertRuleId, + AlertRuleName, + Description, + AlertContext, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Equals, + NotEquals, + Contains, + DoesNotContain, + } +} +pub type Conditions = Vec; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DailyRecurrence { + #[serde(flatten)] + pub recurrence: Recurrence, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DaysOfWeek { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedResource { + #[serde(flatten)] + pub resource: Resource, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitorServiceDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitorServiceList { + #[serde(flatten)] + pub alerts_meta_data_properties: AlertsMetaDataProperties, + pub data: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonthlyRecurrence { + #[serde(flatten)] + pub recurrence: Recurrence, + #[serde(rename = "daysOfMonth")] + pub days_of_month: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PatchObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PatchProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Recurrence { + #[serde(rename = "recurrenceType")] + pub recurrence_type: recurrence::RecurrenceType, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +pub mod recurrence { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecurrenceType { + Daily, + Weekly, + Monthly, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RemoveAllActionGroups { + #[serde(flatten)] + pub action: Action, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Schedule { + #[serde(rename = "effectiveFrom", default, skip_serializing_if = "Option::is_none")] + pub effective_from: Option, + #[serde(rename = "effectiveUntil", default, skip_serializing_if = "Option::is_none")] + pub effective_until: Option, + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recurrences: Vec, +} +pub type Scopes = Vec; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WeeklyRecurrence { + #[serde(flatten)] + pub recurrence: Recurrence, + #[serde(rename = "daysOfWeek")] + pub days_of_week: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Alert { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertContext {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertModification { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertModificationItem { + #[serde(rename = "modificationEvent", default, skip_serializing_if = "Option::is_none")] + pub modification_event: Option, + #[serde(rename = "oldValue", default, skip_serializing_if = "Option::is_none")] + pub old_value: Option, + #[serde(rename = "newValue", default, skip_serializing_if = "Option::is_none")] + pub new_value: Option, + #[serde(rename = "modifiedAt", default, skip_serializing_if = "Option::is_none")] + pub modified_at: Option, + #[serde(rename = "modifiedBy", default, skip_serializing_if = "Option::is_none")] + pub modified_by: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +pub mod alert_modification_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ModificationEvent { + AlertCreated, + StateChange, + MonitorConditionChange, + SeverityChange, + ActionRuleTriggered, + ActionRuleSuppressed, + ActionsTriggered, + ActionsSuppressed, + ActionsFailed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertModificationProperties { + #[serde(rename = "alertId", default, skip_serializing_if = "Option::is_none")] + pub alert_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub modifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub essentials: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[serde(rename = "egressConfig", default, skip_serializing_if = "Option::is_none")] + pub egress_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertsList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertsMetaData { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertsMetaDataProperties { + #[serde(rename = "metadataIdentifier")] + pub metadata_identifier: alerts_meta_data_properties::MetadataIdentifier, +} +pub mod alerts_meta_data_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MetadataIdentifier { + MonitorServiceList, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertsSummary { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertsSummaryGroup { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub total: Option, + #[serde(rename = "smartGroupsCount", default, skip_serializing_if = "Option::is_none")] + pub smart_groups_count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub groupedby: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertsSummaryGroupItem { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub groupedby: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EgressConfig {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponseBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Essentials { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[serde(rename = "signalType", default, skip_serializing_if = "Option::is_none")] + pub signal_type: Option, + #[serde(rename = "alertState", default, skip_serializing_if = "Option::is_none")] + pub alert_state: Option, + #[serde(rename = "monitorCondition", default, skip_serializing_if = "Option::is_none")] + pub monitor_condition: Option, + #[serde(rename = "targetResource", default, skip_serializing_if = "Option::is_none")] + pub target_resource: Option, + #[serde(rename = "targetResourceName", default, skip_serializing_if = "Option::is_none")] + pub target_resource_name: Option, + #[serde(rename = "targetResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group: Option, + #[serde(rename = "targetResourceType", default, skip_serializing_if = "Option::is_none")] + pub target_resource_type: Option, + #[serde(rename = "monitorService", default, skip_serializing_if = "Option::is_none")] + pub monitor_service: Option, + #[serde(rename = "alertRule", default, skip_serializing_if = "Option::is_none")] + pub alert_rule: Option, + #[serde(rename = "sourceCreatedId", default, skip_serializing_if = "Option::is_none")] + pub source_created_id: Option, + #[serde(rename = "smartGroupId", default, skip_serializing_if = "Option::is_none")] + pub smart_group_id: Option, + #[serde(rename = "smartGroupingReason", default, skip_serializing_if = "Option::is_none")] + pub smart_grouping_reason: Option, + #[serde(rename = "startDateTime", default, skip_serializing_if = "Option::is_none")] + pub start_date_time: Option, + #[serde(rename = "lastModifiedDateTime", default, skip_serializing_if = "Option::is_none")] + pub last_modified_date_time: Option, + #[serde(rename = "monitorConditionResolvedDateTime", default, skip_serializing_if = "Option::is_none")] + pub monitor_condition_resolved_date_time: Option, + #[serde(rename = "lastModifiedUserName", default, skip_serializing_if = "Option::is_none")] + pub last_modified_user_name: Option, +} +pub mod essentials { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Severity { + Sev0, + Sev1, + Sev2, + Sev3, + Sev4, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SignalType { + Metric, + Log, + Unknown, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AlertState { + New, + Acknowledged, + Closed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MonitorCondition { + Fired, + Resolved, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MonitorService { + #[serde(rename = "Application Insights")] + ApplicationInsights, + #[serde(rename = "ActivityLog Administrative")] + ActivityLogAdministrative, + #[serde(rename = "ActivityLog Security")] + ActivityLogSecurity, + #[serde(rename = "ActivityLog Recommendation")] + ActivityLogRecommendation, + #[serde(rename = "ActivityLog Policy")] + ActivityLogPolicy, + #[serde(rename = "ActivityLog Autoscale")] + ActivityLogAutoscale, + #[serde(rename = "Log Analytics")] + LogAnalytics, + Nagios, + Platform, + #[serde(rename = "SCOM")] + Scom, + ServiceHealth, + SmartDetector, + #[serde(rename = "VM Insights")] + VmInsights, + Zabbix, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartGroup { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartGroupAggregatedProperty { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartGroupModification { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartGroupModificationItem { + #[serde(rename = "modificationEvent", default, skip_serializing_if = "Option::is_none")] + pub modification_event: Option, + #[serde(rename = "oldValue", default, skip_serializing_if = "Option::is_none")] + pub old_value: Option, + #[serde(rename = "newValue", default, skip_serializing_if = "Option::is_none")] + pub new_value: Option, + #[serde(rename = "modifiedAt", default, skip_serializing_if = "Option::is_none")] + pub modified_at: Option, + #[serde(rename = "modifiedBy", default, skip_serializing_if = "Option::is_none")] + pub modified_by: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +pub mod smart_group_modification_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ModificationEvent { + SmartGroupCreated, + StateChange, + AlertAdded, + AlertRemoved, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartGroupModificationProperties { + #[serde(rename = "smartGroupId", default, skip_serializing_if = "Option::is_none")] + pub smart_group_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub modifications: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartGroupProperties { + #[serde(rename = "alertsCount", default, skip_serializing_if = "Option::is_none")] + pub alerts_count: Option, + #[serde(rename = "smartGroupState", default, skip_serializing_if = "Option::is_none")] + pub smart_group_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[serde(rename = "startDateTime", default, skip_serializing_if = "Option::is_none")] + pub start_date_time: Option, + #[serde(rename = "lastModifiedDateTime", default, skip_serializing_if = "Option::is_none")] + pub last_modified_date_time: Option, + #[serde(rename = "lastModifiedUserName", default, skip_serializing_if = "Option::is_none")] + pub last_modified_user_name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, + #[serde(rename = "resourceTypes", default, skip_serializing_if = "Vec::is_empty")] + pub resource_types: Vec, + #[serde(rename = "resourceGroups", default, skip_serializing_if = "Vec::is_empty")] + pub resource_groups: Vec, + #[serde(rename = "monitorServices", default, skip_serializing_if = "Vec::is_empty")] + pub monitor_services: Vec, + #[serde(rename = "monitorConditions", default, skip_serializing_if = "Vec::is_empty")] + pub monitor_conditions: Vec, + #[serde(rename = "alertStates", default, skip_serializing_if = "Vec::is_empty")] + pub alert_states: Vec, + #[serde(rename = "alertSeverities", default, skip_serializing_if = "Vec::is_empty")] + pub alert_severities: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +pub mod smart_group_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SmartGroupState { + New, + Acknowledged, + Closed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Severity { + Sev0, + Sev1, + Sev2, + Sev3, + Sev4, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartGroupsList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/alertsmanagement/src/package_2021_08/operations.rs b/services/mgmt/alertsmanagement/src/package_2021_08/operations.rs new file mode 100644 index 0000000000..58dea53684 --- /dev/null +++ b/services/mgmt/alertsmanagement/src/package_2021_08/operations.rs @@ -0,0 +1,1954 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn alert_processing_rules(&self) -> alert_processing_rules::Client { + alert_processing_rules::Client(self.clone()) + } + pub fn alerts(&self) -> alerts::Client { + alerts::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn smart_groups(&self) -> smart_groups::Client { + smart_groups::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + AlertProcessingRules_ListBySubscription(#[from] alert_processing_rules::list_by_subscription::Error), + #[error(transparent)] + AlertProcessingRules_ListByResourceGroup(#[from] alert_processing_rules::list_by_resource_group::Error), + #[error(transparent)] + AlertProcessingRules_GetByName(#[from] alert_processing_rules::get_by_name::Error), + #[error(transparent)] + AlertProcessingRules_CreateOrUpdate(#[from] alert_processing_rules::create_or_update::Error), + #[error(transparent)] + AlertProcessingRules_Update(#[from] alert_processing_rules::update::Error), + #[error(transparent)] + AlertProcessingRules_Delete(#[from] alert_processing_rules::delete::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Alerts_MetaData(#[from] alerts::meta_data::Error), + #[error(transparent)] + Alerts_GetAll(#[from] alerts::get_all::Error), + #[error(transparent)] + Alerts_GetById(#[from] alerts::get_by_id::Error), + #[error(transparent)] + Alerts_ChangeState(#[from] alerts::change_state::Error), + #[error(transparent)] + Alerts_GetHistory(#[from] alerts::get_history::Error), + #[error(transparent)] + Alerts_GetSummary(#[from] alerts::get_summary::Error), + #[error(transparent)] + SmartGroups_GetAll(#[from] smart_groups::get_all::Error), + #[error(transparent)] + SmartGroups_GetById(#[from] smart_groups::get_by_id::Error), + #[error(transparent)] + SmartGroups_ChangeState(#[from] smart_groups::change_state::Error), + #[error(transparent)] + SmartGroups_GetHistory(#[from] smart_groups::get_history::Error), +} +pub mod alert_processing_rules { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get_by_name( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + alert_processing_rule_name: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + alert_processing_rule_name: alert_processing_rule_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + alert_processing_rule_name: impl Into, + alert_processing_rule: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + alert_processing_rule_name: alert_processing_rule_name.into(), + alert_processing_rule: alert_processing_rule.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + alert_processing_rule_name: impl Into, + alert_processing_rule_patch: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + alert_processing_rule_name: alert_processing_rule_name.into(), + alert_processing_rule_patch: alert_processing_rule_patch.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + alert_processing_rule_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + alert_processing_rule_name: alert_processing_rule_name.into(), + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/actionRules", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertProcessingRulesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AlertsManagement/actionRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertProcessingRulesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_name { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) alert_processing_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AlertsManagement/actionRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.alert_processing_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertProcessingRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AlertProcessingRule), + Created201(models::AlertProcessingRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) alert_processing_rule_name: String, + pub(crate) alert_processing_rule: models::AlertProcessingRule, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AlertsManagement/actionRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.alert_processing_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.alert_processing_rule).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertProcessingRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertProcessingRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) alert_processing_rule_name: String, + pub(crate) alert_processing_rule_patch: models::PatchObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AlertsManagement/actionRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.alert_processing_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.alert_processing_rule_patch).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertProcessingRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) alert_processing_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AlertsManagement/actionRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.alert_processing_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.AlertsManagement/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod alerts { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn meta_data(&self, identifier: impl Into) -> meta_data::Builder { + meta_data::Builder { + client: self.0.clone(), + identifier: identifier.into(), + } + } + pub fn get_all(&self, subscription_id: impl Into) -> get_all::Builder { + get_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + target_resource: None, + target_resource_type: None, + target_resource_group: None, + monitor_service: None, + monitor_condition: None, + severity: None, + alert_state: None, + alert_rule: None, + smart_group_id: None, + include_context: None, + include_egress_config: None, + page_count: None, + sort_by: None, + sort_order: None, + select: None, + time_range: None, + custom_time_range: None, + } + } + #[doc = "Get a specific alert."] + pub fn get_by_id(&self, subscription_id: impl Into, alert_id: impl Into) -> get_by_id::Builder { + get_by_id::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + alert_id: alert_id.into(), + } + } + pub fn change_state( + &self, + subscription_id: impl Into, + alert_id: impl Into, + new_state: impl Into, + ) -> change_state::Builder { + change_state::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + alert_id: alert_id.into(), + new_state: new_state.into(), + } + } + pub fn get_history(&self, subscription_id: impl Into, alert_id: impl Into) -> get_history::Builder { + get_history::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + alert_id: alert_id.into(), + } + } + pub fn get_summary(&self, subscription_id: impl Into, groupby: impl Into) -> get_summary::Builder { + get_summary::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + groupby: groupby.into(), + include_smart_groups_count: None, + target_resource: None, + target_resource_type: None, + target_resource_group: None, + monitor_service: None, + monitor_condition: None, + severity: None, + alert_state: None, + alert_rule: None, + time_range: None, + custom_time_range: None, + } + } + } + pub mod meta_data { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) identifier: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.AlertsManagement/alertsMetaData", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let identifier = &self.identifier; + url.query_pairs_mut().append_pair("identifier", identifier); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertsMetaData = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_all { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) target_resource: Option, + pub(crate) target_resource_type: Option, + pub(crate) target_resource_group: Option, + pub(crate) monitor_service: Option, + pub(crate) monitor_condition: Option, + pub(crate) severity: Option, + pub(crate) alert_state: Option, + pub(crate) alert_rule: Option, + pub(crate) smart_group_id: Option, + pub(crate) include_context: Option, + pub(crate) include_egress_config: Option, + pub(crate) page_count: Option, + pub(crate) sort_by: Option, + pub(crate) sort_order: Option, + pub(crate) select: Option, + pub(crate) time_range: Option, + pub(crate) custom_time_range: Option, + } + impl Builder { + pub fn target_resource(mut self, target_resource: impl Into) -> Self { + self.target_resource = Some(target_resource.into()); + self + } + pub fn target_resource_type(mut self, target_resource_type: impl Into) -> Self { + self.target_resource_type = Some(target_resource_type.into()); + self + } + pub fn target_resource_group(mut self, target_resource_group: impl Into) -> Self { + self.target_resource_group = Some(target_resource_group.into()); + self + } + pub fn monitor_service(mut self, monitor_service: impl Into) -> Self { + self.monitor_service = Some(monitor_service.into()); + self + } + pub fn monitor_condition(mut self, monitor_condition: impl Into) -> Self { + self.monitor_condition = Some(monitor_condition.into()); + self + } + pub fn severity(mut self, severity: impl Into) -> Self { + self.severity = Some(severity.into()); + self + } + pub fn alert_state(mut self, alert_state: impl Into) -> Self { + self.alert_state = Some(alert_state.into()); + self + } + pub fn alert_rule(mut self, alert_rule: impl Into) -> Self { + self.alert_rule = Some(alert_rule.into()); + self + } + pub fn smart_group_id(mut self, smart_group_id: impl Into) -> Self { + self.smart_group_id = Some(smart_group_id.into()); + self + } + pub fn include_context(mut self, include_context: bool) -> Self { + self.include_context = Some(include_context); + self + } + pub fn include_egress_config(mut self, include_egress_config: bool) -> Self { + self.include_egress_config = Some(include_egress_config); + self + } + pub fn page_count(mut self, page_count: i64) -> Self { + self.page_count = Some(page_count); + self + } + pub fn sort_by(mut self, sort_by: impl Into) -> Self { + self.sort_by = Some(sort_by.into()); + self + } + pub fn sort_order(mut self, sort_order: impl Into) -> Self { + self.sort_order = Some(sort_order.into()); + self + } + pub fn select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn time_range(mut self, time_range: impl Into) -> Self { + self.time_range = Some(time_range.into()); + self + } + pub fn custom_time_range(mut self, custom_time_range: impl Into) -> Self { + self.custom_time_range = Some(custom_time_range.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/alerts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(target_resource) = &self.target_resource { + url.query_pairs_mut().append_pair("targetResource", target_resource); + } + if let Some(target_resource_type) = &self.target_resource_type { + url.query_pairs_mut().append_pair("targetResourceType", target_resource_type); + } + if let Some(target_resource_group) = &self.target_resource_group { + url.query_pairs_mut().append_pair("targetResourceGroup", target_resource_group); + } + if let Some(monitor_service) = &self.monitor_service { + url.query_pairs_mut().append_pair("monitorService", monitor_service); + } + if let Some(monitor_condition) = &self.monitor_condition { + url.query_pairs_mut().append_pair("monitorCondition", monitor_condition); + } + if let Some(severity) = &self.severity { + url.query_pairs_mut().append_pair("severity", severity); + } + if let Some(alert_state) = &self.alert_state { + url.query_pairs_mut().append_pair("alertState", alert_state); + } + if let Some(alert_rule) = &self.alert_rule { + url.query_pairs_mut().append_pair("alertRule", alert_rule); + } + if let Some(smart_group_id) = &self.smart_group_id { + url.query_pairs_mut().append_pair("smartGroupId", smart_group_id); + } + if let Some(include_context) = &self.include_context { + url.query_pairs_mut().append_pair("includeContext", &include_context.to_string()); + } + if let Some(include_egress_config) = &self.include_egress_config { + url.query_pairs_mut() + .append_pair("includeEgressConfig", &include_egress_config.to_string()); + } + if let Some(page_count) = &self.page_count { + url.query_pairs_mut().append_pair("pageCount", &page_count.to_string()); + } + if let Some(sort_by) = &self.sort_by { + url.query_pairs_mut().append_pair("sortBy", sort_by); + } + if let Some(sort_order) = &self.sort_order { + url.query_pairs_mut().append_pair("sortOrder", sort_order); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("select", select); + } + if let Some(time_range) = &self.time_range { + url.query_pairs_mut().append_pair("timeRange", time_range); + } + if let Some(custom_time_range) = &self.custom_time_range { + url.query_pairs_mut().append_pair("customTimeRange", custom_time_range); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_id { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) alert_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/alerts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.alert_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod change_state { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) alert_id: String, + pub(crate) new_state: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/alerts/{}/changestate", + self.client.endpoint(), + &self.subscription_id, + &self.alert_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let new_state = &self.new_state; + url.query_pairs_mut().append_pair("newState", new_state); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_history { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) alert_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/alerts/{}/history", + self.client.endpoint(), + &self.subscription_id, + &self.alert_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertModification = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_summary { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) groupby: String, + pub(crate) include_smart_groups_count: Option, + pub(crate) target_resource: Option, + pub(crate) target_resource_type: Option, + pub(crate) target_resource_group: Option, + pub(crate) monitor_service: Option, + pub(crate) monitor_condition: Option, + pub(crate) severity: Option, + pub(crate) alert_state: Option, + pub(crate) alert_rule: Option, + pub(crate) time_range: Option, + pub(crate) custom_time_range: Option, + } + impl Builder { + pub fn include_smart_groups_count(mut self, include_smart_groups_count: bool) -> Self { + self.include_smart_groups_count = Some(include_smart_groups_count); + self + } + pub fn target_resource(mut self, target_resource: impl Into) -> Self { + self.target_resource = Some(target_resource.into()); + self + } + pub fn target_resource_type(mut self, target_resource_type: impl Into) -> Self { + self.target_resource_type = Some(target_resource_type.into()); + self + } + pub fn target_resource_group(mut self, target_resource_group: impl Into) -> Self { + self.target_resource_group = Some(target_resource_group.into()); + self + } + pub fn monitor_service(mut self, monitor_service: impl Into) -> Self { + self.monitor_service = Some(monitor_service.into()); + self + } + pub fn monitor_condition(mut self, monitor_condition: impl Into) -> Self { + self.monitor_condition = Some(monitor_condition.into()); + self + } + pub fn severity(mut self, severity: impl Into) -> Self { + self.severity = Some(severity.into()); + self + } + pub fn alert_state(mut self, alert_state: impl Into) -> Self { + self.alert_state = Some(alert_state.into()); + self + } + pub fn alert_rule(mut self, alert_rule: impl Into) -> Self { + self.alert_rule = Some(alert_rule.into()); + self + } + pub fn time_range(mut self, time_range: impl Into) -> Self { + self.time_range = Some(time_range.into()); + self + } + pub fn custom_time_range(mut self, custom_time_range: impl Into) -> Self { + self.custom_time_range = Some(custom_time_range.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/alertsSummary", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let groupby = &self.groupby; + url.query_pairs_mut().append_pair("groupby", groupby); + if let Some(include_smart_groups_count) = &self.include_smart_groups_count { + url.query_pairs_mut() + .append_pair("includeSmartGroupsCount", &include_smart_groups_count.to_string()); + } + if let Some(target_resource) = &self.target_resource { + url.query_pairs_mut().append_pair("targetResource", target_resource); + } + if let Some(target_resource_type) = &self.target_resource_type { + url.query_pairs_mut().append_pair("targetResourceType", target_resource_type); + } + if let Some(target_resource_group) = &self.target_resource_group { + url.query_pairs_mut().append_pair("targetResourceGroup", target_resource_group); + } + if let Some(monitor_service) = &self.monitor_service { + url.query_pairs_mut().append_pair("monitorService", monitor_service); + } + if let Some(monitor_condition) = &self.monitor_condition { + url.query_pairs_mut().append_pair("monitorCondition", monitor_condition); + } + if let Some(severity) = &self.severity { + url.query_pairs_mut().append_pair("severity", severity); + } + if let Some(alert_state) = &self.alert_state { + url.query_pairs_mut().append_pair("alertState", alert_state); + } + if let Some(alert_rule) = &self.alert_rule { + url.query_pairs_mut().append_pair("alertRule", alert_rule); + } + if let Some(time_range) = &self.time_range { + url.query_pairs_mut().append_pair("timeRange", time_range); + } + if let Some(custom_time_range) = &self.custom_time_range { + url.query_pairs_mut().append_pair("customTimeRange", custom_time_range); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertsSummary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod smart_groups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get all Smart Groups within a specified subscription"] + pub fn get_all(&self, subscription_id: impl Into) -> get_all::Builder { + get_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + target_resource: None, + target_resource_group: None, + target_resource_type: None, + monitor_service: None, + monitor_condition: None, + severity: None, + smart_group_state: None, + time_range: None, + page_count: None, + sort_by: None, + sort_order: None, + } + } + #[doc = "Get information related to a specific Smart Group."] + pub fn get_by_id(&self, subscription_id: impl Into, smart_group_id: impl Into) -> get_by_id::Builder { + get_by_id::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + smart_group_id: smart_group_id.into(), + } + } + pub fn change_state( + &self, + subscription_id: impl Into, + smart_group_id: impl Into, + new_state: impl Into, + ) -> change_state::Builder { + change_state::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + smart_group_id: smart_group_id.into(), + new_state: new_state.into(), + } + } + pub fn get_history(&self, subscription_id: impl Into, smart_group_id: impl Into) -> get_history::Builder { + get_history::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + smart_group_id: smart_group_id.into(), + } + } + } + pub mod get_all { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) target_resource: Option, + pub(crate) target_resource_group: Option, + pub(crate) target_resource_type: Option, + pub(crate) monitor_service: Option, + pub(crate) monitor_condition: Option, + pub(crate) severity: Option, + pub(crate) smart_group_state: Option, + pub(crate) time_range: Option, + pub(crate) page_count: Option, + pub(crate) sort_by: Option, + pub(crate) sort_order: Option, + } + impl Builder { + pub fn target_resource(mut self, target_resource: impl Into) -> Self { + self.target_resource = Some(target_resource.into()); + self + } + pub fn target_resource_group(mut self, target_resource_group: impl Into) -> Self { + self.target_resource_group = Some(target_resource_group.into()); + self + } + pub fn target_resource_type(mut self, target_resource_type: impl Into) -> Self { + self.target_resource_type = Some(target_resource_type.into()); + self + } + pub fn monitor_service(mut self, monitor_service: impl Into) -> Self { + self.monitor_service = Some(monitor_service.into()); + self + } + pub fn monitor_condition(mut self, monitor_condition: impl Into) -> Self { + self.monitor_condition = Some(monitor_condition.into()); + self + } + pub fn severity(mut self, severity: impl Into) -> Self { + self.severity = Some(severity.into()); + self + } + pub fn smart_group_state(mut self, smart_group_state: impl Into) -> Self { + self.smart_group_state = Some(smart_group_state.into()); + self + } + pub fn time_range(mut self, time_range: impl Into) -> Self { + self.time_range = Some(time_range.into()); + self + } + pub fn page_count(mut self, page_count: i64) -> Self { + self.page_count = Some(page_count); + self + } + pub fn sort_by(mut self, sort_by: impl Into) -> Self { + self.sort_by = Some(sort_by.into()); + self + } + pub fn sort_order(mut self, sort_order: impl Into) -> Self { + self.sort_order = Some(sort_order.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/smartGroups", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(target_resource) = &self.target_resource { + url.query_pairs_mut().append_pair("targetResource", target_resource); + } + if let Some(target_resource_group) = &self.target_resource_group { + url.query_pairs_mut().append_pair("targetResourceGroup", target_resource_group); + } + if let Some(target_resource_type) = &self.target_resource_type { + url.query_pairs_mut().append_pair("targetResourceType", target_resource_type); + } + if let Some(monitor_service) = &self.monitor_service { + url.query_pairs_mut().append_pair("monitorService", monitor_service); + } + if let Some(monitor_condition) = &self.monitor_condition { + url.query_pairs_mut().append_pair("monitorCondition", monitor_condition); + } + if let Some(severity) = &self.severity { + url.query_pairs_mut().append_pair("severity", severity); + } + if let Some(smart_group_state) = &self.smart_group_state { + url.query_pairs_mut().append_pair("smartGroupState", smart_group_state); + } + if let Some(time_range) = &self.time_range { + url.query_pairs_mut().append_pair("timeRange", time_range); + } + if let Some(page_count) = &self.page_count { + url.query_pairs_mut().append_pair("pageCount", &page_count.to_string()); + } + if let Some(sort_by) = &self.sort_by { + url.query_pairs_mut().append_pair("sortBy", sort_by); + } + if let Some(sort_order) = &self.sort_order { + url.query_pairs_mut().append_pair("sortOrder", sort_order); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SmartGroupsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_id { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) smart_group_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/smartGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.smart_group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SmartGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod change_state { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) smart_group_id: String, + pub(crate) new_state: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/smartGroups/{}/changeState", + self.client.endpoint(), + &self.subscription_id, + &self.smart_group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let new_state = &self.new_state; + url.query_pairs_mut().append_pair("newState", new_state); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SmartGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_history { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) smart_group_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AlertsManagement/smartGroups/{}/history", + self.client.endpoint(), + &self.subscription_id, + &self.smart_group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SmartGroupModification = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/apimanagement/src/package_2021_08/models.rs b/services/mgmt/apimanagement/src/package_2021_08/models.rs index 18272bd6e6..0e5ab16942 100644 --- a/services/mgmt/apimanagement/src/package_2021_08/models.rs +++ b/services/mgmt/apimanagement/src/package_2021_08/models.rs @@ -1784,6 +1784,45 @@ pub struct GenerateSsoUrlResult { pub value: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GlobalSchemaCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GlobalSchemaContract { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GlobalSchemaContractProperties { + #[serde(rename = "schemaType")] + pub schema_type: global_schema_contract_properties::SchemaType, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub document: Option, +} +pub mod global_schema_contract_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SchemaType { + #[serde(rename = "xml")] + Xml, + #[serde(rename = "json")] + Json, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GlobalSchemaDocumentProperties {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct GroupCollection { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub value: Vec, diff --git a/services/mgmt/apimanagement/src/package_2021_08/operations.rs b/services/mgmt/apimanagement/src/package_2021_08/operations.rs index e75ac2434b..b2b69f04fb 100644 --- a/services/mgmt/apimanagement/src/package_2021_08/operations.rs +++ b/services/mgmt/apimanagement/src/package_2021_08/operations.rs @@ -137,6 +137,9 @@ impl Client { pub fn gateway_hostname_configuration(&self) -> gateway_hostname_configuration::Client { gateway_hostname_configuration::Client(self.clone()) } + pub fn global_schema(&self) -> global_schema::Client { + global_schema::Client(self.clone()) + } pub fn group(&self) -> group::Client { group::Client(self.clone()) } @@ -703,6 +706,16 @@ pub enum Error { #[error(transparent)] Reports_ListByRequest(#[from] reports::list_by_request::Error), #[error(transparent)] + GlobalSchema_ListByService(#[from] global_schema::list_by_service::Error), + #[error(transparent)] + GlobalSchema_Get(#[from] global_schema::get::Error), + #[error(transparent)] + GlobalSchema_CreateOrUpdate(#[from] global_schema::create_or_update::Error), + #[error(transparent)] + GlobalSchema_Delete(#[from] global_schema::delete::Error), + #[error(transparent)] + GlobalSchema_GetEntityTag(#[from] global_schema::get_entity_tag::Error), + #[error(transparent)] TenantSettings_ListByService(#[from] tenant_settings::list_by_service::Error), #[error(transparent)] TenantSettings_Get(#[from] tenant_settings::get::Error), @@ -23961,6 +23974,531 @@ pub mod reports { } } } +pub mod global_schema { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + schema_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + schema_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + schema_id: schema_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + schema_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + schema_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GlobalSchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) schema_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GlobalSchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Created201(models::GlobalSchemaContract), + Ok200(models::GlobalSchemaContract), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::GlobalSchemaContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GlobalSchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GlobalSchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) schema_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} pub mod tenant_settings { use super::{models, API_VERSION}; pub struct Client(pub(crate) super::Client); diff --git a/services/mgmt/applicationinsights/Cargo.toml b/services/mgmt/applicationinsights/Cargo.toml index cde5659722..565e406ba2 100644 --- a/services/mgmt/applicationinsights/Cargo.toml +++ b/services/mgmt/applicationinsights/Cargo.toml @@ -24,6 +24,8 @@ enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] "package-2021-10" = [] +"package-2021-08" = [] +"package-2021-03-08-only" = [] "package-2021-03-only" = [] "package-preview-2021-03-only" = [] "package-2020-11-only" = [] diff --git a/services/mgmt/applicationinsights/src/lib.rs b/services/mgmt/applicationinsights/src/lib.rs index 412bfa19f8..9c07c8fed1 100644 --- a/services/mgmt/applicationinsights/src/lib.rs +++ b/services/mgmt/applicationinsights/src/lib.rs @@ -7,6 +7,14 @@ pub mod package_2021_10; #[cfg(all(feature = "package-2021-10", not(feature = "no-default-version")))] pub use package_2021_10::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-08")] +pub mod package_2021_08; +#[cfg(all(feature = "package-2021-08", not(feature = "no-default-version")))] +pub use package_2021_08::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-03-08-only")] +pub mod package_2021_03_08_only; +#[cfg(all(feature = "package-2021-03-08-only", not(feature = "no-default-version")))] +pub use package_2021_03_08_only::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-03-only")] pub mod package_2021_03_only; #[cfg(all(feature = "package-2021-03-only", not(feature = "no-default-version")))] diff --git a/services/mgmt/applicationinsights/src/package_2018_06_17_preview/models.rs b/services/mgmt/applicationinsights/src/package_2018_06_17_preview/models.rs index 2221e47cf4..59e0a1ba66 100644 --- a/services/mgmt/applicationinsights/src/package_2018_06_17_preview/models.rs +++ b/services/mgmt/applicationinsights/src/package_2018_06_17_preview/models.rs @@ -12,6 +12,39 @@ pub struct ErrorFieldContract { pub target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Resource { #[serde(default, skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/services/mgmt/applicationinsights/src/package_2018_06_17_preview/operations.rs b/services/mgmt/applicationinsights/src/package_2018_06_17_preview/operations.rs index af4b6d755d..513e1a36de 100644 --- a/services/mgmt/applicationinsights/src/package_2018_06_17_preview/operations.rs +++ b/services/mgmt/applicationinsights/src/package_2018_06_17_preview/operations.rs @@ -74,6 +74,9 @@ impl Client { pipeline, } } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } pub fn workbooks(&self) -> workbooks::Client { workbooks::Client(self.clone()) } @@ -92,6 +95,8 @@ pub enum Error { Workbooks_Update(#[from] workbooks::update::Error), #[error(transparent)] Workbooks_Delete(#[from] workbooks::delete::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), } pub mod workbooks { use super::{models, API_VERSION}; @@ -607,3 +612,80 @@ pub mod workbooks { } } } +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Insights/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/applicationinsights/src/package_2021_03_08_only/mod.rs b/services/mgmt/applicationinsights/src/package_2021_03_08_only/mod.rs new file mode 100644 index 0000000000..5ff1564831 --- /dev/null +++ b/services/mgmt/applicationinsights/src/package_2021_03_08_only/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-03-08"; diff --git a/services/mgmt/applicationinsights/src/package_2021_03_08_only/models.rs b/services/mgmt/applicationinsights/src/package_2021_03_08_only/models.rs new file mode 100644 index 0000000000..ac82a8f185 --- /dev/null +++ b/services/mgmt/applicationinsights/src/package_2021_03_08_only/models.rs @@ -0,0 +1,142 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub innererror: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InnerErrorTrace { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub trace: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MyWorkbook { + #[serde(flatten)] + pub my_workbook_resource: MyWorkbookResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +pub mod my_workbook { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "user")] + User, + #[serde(rename = "shared")] + Shared, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MyWorkbookError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MyWorkbookManagedIdentity { + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod my_workbook_managed_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + UserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MyWorkbookProperties { + #[serde(rename = "displayName")] + pub display_name: String, + #[serde(rename = "serializedData")] + pub serialized_data: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "timeModified", default, skip_serializing_if = "Option::is_none")] + pub time_modified: Option, + pub category: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tags: Vec, + #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")] + pub user_id: Option, + #[serde(rename = "sourceId", default, skip_serializing_if = "Option::is_none")] + pub source_id: Option, + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MyWorkbookResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MyWorkbookUserAssignedIdentities { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MyWorkbooksListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/applicationinsights/src/package_2021_03_08_only/operations.rs b/services/mgmt/applicationinsights/src/package_2021_03_08_only/operations.rs new file mode 100644 index 0000000000..6f6c342765 --- /dev/null +++ b/services/mgmt/applicationinsights/src/package_2021_03_08_only/operations.rs @@ -0,0 +1,718 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn my_workbooks(&self) -> my_workbooks::Client { + my_workbooks::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + MyWorkbooks_ListByResourceGroup(#[from] my_workbooks::list_by_resource_group::Error), + #[error(transparent)] + MyWorkbooks_ListBySubscription(#[from] my_workbooks::list_by_subscription::Error), + #[error(transparent)] + MyWorkbooks_Get(#[from] my_workbooks::get::Error), + #[error(transparent)] + MyWorkbooks_CreateOrUpdate(#[from] my_workbooks::create_or_update::Error), + #[error(transparent)] + MyWorkbooks_Update(#[from] my_workbooks::update::Error), + #[error(transparent)] + MyWorkbooks_Delete(#[from] my_workbooks::delete::Error), +} +pub mod my_workbooks { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + category: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + category: category.into(), + tags: Vec::new(), + source_id: None, + can_fetch_content: None, + } + } + pub fn list_by_subscription( + &self, + subscription_id: impl Into, + category: impl Into, + ) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + category: category.into(), + tags: Vec::new(), + can_fetch_content: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + workbook_properties: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + workbook_properties: workbook_properties.into(), + source_id: None, + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + workbook_properties: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + workbook_properties: workbook_properties.into(), + source_id: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::MyWorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) category: String, + pub(crate) tags: Vec, + pub(crate) source_id: Option, + pub(crate) can_fetch_content: Option, + } + impl Builder { + pub fn tags(mut self, tags: Vec) -> Self { + self.tags = tags; + self + } + pub fn source_id(mut self, source_id: impl Into) -> Self { + self.source_id = Some(source_id.into()); + self + } + pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self { + self.can_fetch_content = Some(can_fetch_content); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let category = &self.category; + url.query_pairs_mut().append_pair("category", category); + if let Some(source_id) = &self.source_id { + url.query_pairs_mut().append_pair("sourceId", source_id); + } + if let Some(can_fetch_content) = &self.can_fetch_content { + url.query_pairs_mut().append_pair("canFetchContent", &can_fetch_content.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbooksListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::MyWorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) category: String, + pub(crate) tags: Vec, + pub(crate) can_fetch_content: Option, + } + impl Builder { + pub fn tags(mut self, tags: Vec) -> Self { + self.tags = tags; + self + } + pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self { + self.can_fetch_content = Some(can_fetch_content); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Insights/myWorkbooks", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let category = &self.category; + url.query_pairs_mut().append_pair("category", category); + if let Some(can_fetch_content) = &self.can_fetch_content { + url.query_pairs_mut().append_pair("canFetchContent", &can_fetch_content.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbooksListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::MyWorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MyWorkbook), + Created201(models::MyWorkbook), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::MyWorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) workbook_properties: models::MyWorkbook, + pub(crate) source_id: Option, + } + impl Builder { + pub fn source_id(mut self, source_id: impl Into) -> Self { + self.source_id = Some(source_id.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(source_id) = &self.source_id { + url.query_pairs_mut().append_pair("sourceId", source_id); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.workbook_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::MyWorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) workbook_properties: models::MyWorkbook, + pub(crate) source_id: Option, + } + impl Builder { + pub fn source_id(mut self, source_id: impl Into) -> Self { + self.source_id = Some(source_id.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(source_id) = &self.source_id { + url.query_pairs_mut().append_pair("sourceId", source_id); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.workbook_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::MyWorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MyWorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/applicationinsights/src/package_2021_08/mod.rs b/services/mgmt/applicationinsights/src/package_2021_08/mod.rs new file mode 100644 index 0000000000..fdc89d4415 --- /dev/null +++ b/services/mgmt/applicationinsights/src/package_2021_08/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-08-01"; diff --git a/services/mgmt/applicationinsights/src/package_2021_08/models.rs b/services/mgmt/applicationinsights/src/package_2021_08/models.rs new file mode 100644 index 0000000000..6fcefcce99 --- /dev/null +++ b/services/mgmt/applicationinsights/src/package_2021_08/models.rs @@ -0,0 +1,195 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedServiceIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type")] + pub type_: ManagedServiceIdentityType, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ManagedServiceIdentityType { + None, + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned,UserAssigned")] + SystemAssignedUserAssigned, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentities {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Workbook { + #[serde(flatten)] + pub workbook_resource: WorkbookResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkbookError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkbookErrorDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "innerError", default, skip_serializing_if = "Option::is_none")] + pub inner_error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkbookInnerErrorTrace { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub trace: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkbookProperties { + #[serde(rename = "displayName")] + pub display_name: String, + #[serde(rename = "serializedData")] + pub serialized_data: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "timeModified", default, skip_serializing_if = "Option::is_none")] + pub time_modified: Option, + pub category: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tags: Vec, + #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")] + pub user_id: Option, + #[serde(rename = "sourceId", default, skip_serializing_if = "Option::is_none")] + pub source_id: Option, + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub revision: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkbookPropertiesUpdateParameters { + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "serializedData", default, skip_serializing_if = "Option::is_none")] + pub serialized_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tags: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub revision: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkbookResource { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +pub mod workbook_resource { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "user")] + User, + #[serde(rename = "shared")] + Shared, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkbookUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod workbook_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "user")] + User, + #[serde(rename = "shared")] + Shared, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkbooksListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/applicationinsights/src/package_2021_08/operations.rs b/services/mgmt/applicationinsights/src/package_2021_08/operations.rs new file mode 100644 index 0000000000..e1d7065b37 --- /dev/null +++ b/services/mgmt/applicationinsights/src/package_2021_08/operations.rs @@ -0,0 +1,913 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn workbooks(&self) -> workbooks::Client { + workbooks::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Workbooks_ListBySubscription(#[from] workbooks::list_by_subscription::Error), + #[error(transparent)] + Workbooks_ListByResourceGroup(#[from] workbooks::list_by_resource_group::Error), + #[error(transparent)] + Workbooks_Get(#[from] workbooks::get::Error), + #[error(transparent)] + Workbooks_CreateOrUpdate(#[from] workbooks::create_or_update::Error), + #[error(transparent)] + Workbooks_Update(#[from] workbooks::update::Error), + #[error(transparent)] + Workbooks_Delete(#[from] workbooks::delete::Error), + #[error(transparent)] + Workbooks_RevisionsList(#[from] workbooks::revisions_list::Error), + #[error(transparent)] + Workbooks_RevisionGet(#[from] workbooks::revision_get::Error), +} +pub mod workbooks { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription( + &self, + subscription_id: impl Into, + category: impl Into, + ) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + category: category.into(), + tags: Vec::new(), + can_fetch_content: None, + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + category: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + category: category.into(), + tags: Vec::new(), + source_id: None, + can_fetch_content: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + workbook_properties: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + workbook_properties: workbook_properties.into(), + source_id: None, + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + source_id: None, + workbook_update_parameters: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn revisions_list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> revisions_list::Builder { + revisions_list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn revision_get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + revision_id: impl Into, + ) -> revision_get::Builder { + revision_get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + revision_id: revision_id.into(), + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::WorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) category: String, + pub(crate) tags: Vec, + pub(crate) can_fetch_content: Option, + } + impl Builder { + pub fn tags(mut self, tags: Vec) -> Self { + self.tags = tags; + self + } + pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self { + self.can_fetch_content = Some(can_fetch_content); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Insights/workbooks", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let category = &self.category; + url.query_pairs_mut().append_pair("category", category); + if let Some(can_fetch_content) = &self.can_fetch_content { + url.query_pairs_mut().append_pair("canFetchContent", &can_fetch_content.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbooksListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::WorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) category: String, + pub(crate) tags: Vec, + pub(crate) source_id: Option, + pub(crate) can_fetch_content: Option, + } + impl Builder { + pub fn tags(mut self, tags: Vec) -> Self { + self.tags = tags; + self + } + pub fn source_id(mut self, source_id: impl Into) -> Self { + self.source_id = Some(source_id.into()); + self + } + pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self { + self.can_fetch_content = Some(can_fetch_content); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let category = &self.category; + url.query_pairs_mut().append_pair("category", category); + if let Some(source_id) = &self.source_id { + url.query_pairs_mut().append_pair("sourceId", source_id); + } + if let Some(can_fetch_content) = &self.can_fetch_content { + url.query_pairs_mut().append_pair("canFetchContent", &can_fetch_content.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbooksListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::WorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Workbook), + Created201(models::Workbook), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::WorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) workbook_properties: models::Workbook, + pub(crate) source_id: Option, + } + impl Builder { + pub fn source_id(mut self, source_id: impl Into) -> Self { + self.source_id = Some(source_id.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(source_id) = &self.source_id { + url.query_pairs_mut().append_pair("sourceId", source_id); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.workbook_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::WorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) source_id: Option, + pub(crate) workbook_update_parameters: Option, + } + impl Builder { + pub fn source_id(mut self, source_id: impl Into) -> Self { + self.source_id = Some(source_id.into()); + self + } + pub fn workbook_update_parameters(mut self, workbook_update_parameters: impl Into) -> Self { + self.workbook_update_parameters = Some(workbook_update_parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(source_id) = &self.source_id { + url.query_pairs_mut().append_pair("sourceId", source_id); + } + let req_body = if let Some(workbook_update_parameters) = &self.workbook_update_parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(workbook_update_parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::WorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod revisions_list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::WorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}/revisions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbooksListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod revision_get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::WorkbookError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) revision_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}/revisions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.revision_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workbook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkbookError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/appplatform/Cargo.toml b/services/mgmt/appplatform/Cargo.toml index f6c68857b3..609bff90b0 100644 --- a/services/mgmt/appplatform/Cargo.toml +++ b/services/mgmt/appplatform/Cargo.toml @@ -23,6 +23,7 @@ default = ["package-2020-07", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-preview-2022-01" = [] "package-preview-2021-09" = [] "package-preview-2021-06" = [] "package-preview-2020-11" = [] diff --git a/services/mgmt/appplatform/src/lib.rs b/services/mgmt/appplatform/src/lib.rs index 2d02ca00ba..edbbe0630a 100644 --- a/services/mgmt/appplatform/src/lib.rs +++ b/services/mgmt/appplatform/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-preview-2022-01")] +pub mod package_preview_2022_01; +#[cfg(all(feature = "package-preview-2022-01", not(feature = "no-default-version")))] +pub use package_preview_2022_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-preview-2021-09")] pub mod package_preview_2021_09; #[cfg(all(feature = "package-preview-2021-09", not(feature = "no-default-version")))] diff --git a/services/mgmt/appplatform/src/package_2019_05_01_preview/models.rs b/services/mgmt/appplatform/src/package_2019_05_01_preview/models.rs index 6e193addeb..641b6df4e0 100644 --- a/services/mgmt/appplatform/src/package_2019_05_01_preview/models.rs +++ b/services/mgmt/appplatform/src/package_2019_05_01_preview/models.rs @@ -504,11 +504,20 @@ pub struct OperationDetail { pub is_data_action: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub display: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub origin: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, } +pub mod operation_detail { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationDisplay { #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/services/mgmt/appplatform/src/package_2020_07/models.rs b/services/mgmt/appplatform/src/package_2020_07/models.rs index 6eee2326f5..f2d0acd13d 100644 --- a/services/mgmt/appplatform/src/package_2020_07/models.rs +++ b/services/mgmt/appplatform/src/package_2020_07/models.rs @@ -547,11 +547,20 @@ pub struct OperationDetail { pub is_data_action: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub display: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub origin: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, } +pub mod operation_detail { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationDisplay { #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/services/mgmt/appplatform/src/package_preview_2020_11/models.rs b/services/mgmt/appplatform/src/package_preview_2020_11/models.rs index a60128cf4c..e83a31c283 100644 --- a/services/mgmt/appplatform/src/package_preview_2020_11/models.rs +++ b/services/mgmt/appplatform/src/package_preview_2020_11/models.rs @@ -553,11 +553,20 @@ pub struct OperationDetail { pub is_data_action: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub display: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub origin: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, } +pub mod operation_detail { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationDisplay { #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/services/mgmt/appplatform/src/package_preview_2021_06/models.rs b/services/mgmt/appplatform/src/package_preview_2021_06/models.rs index bf2f869829..0b83e2df0b 100644 --- a/services/mgmt/appplatform/src/package_preview_2021_06/models.rs +++ b/services/mgmt/appplatform/src/package_preview_2021_06/models.rs @@ -575,11 +575,20 @@ pub struct OperationDetail { pub is_data_action: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub display: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub origin: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, } +pub mod operation_detail { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationDisplay { #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/services/mgmt/appplatform/src/package_preview_2021_09/models.rs b/services/mgmt/appplatform/src/package_preview_2021_09/models.rs index 397658ada2..06b8a3cb82 100644 --- a/services/mgmt/appplatform/src/package_preview_2021_09/models.rs +++ b/services/mgmt/appplatform/src/package_preview_2021_09/models.rs @@ -265,7 +265,8 @@ pub struct ConfigServerSettingsValidateResult { pub struct ContentCertificateProperties { #[serde(flatten)] pub certificate_properties: CertificateProperties, - pub content: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CustomContainer { @@ -658,11 +659,20 @@ pub struct OperationDetail { pub is_data_action: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub display: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub origin: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, } +pub mod operation_detail { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationDisplay { #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/services/mgmt/appplatform/src/package_preview_2022_01/mod.rs b/services/mgmt/appplatform/src/package_preview_2022_01/mod.rs new file mode 100644 index 0000000000..fc476b12c2 --- /dev/null +++ b/services/mgmt/appplatform/src/package_preview_2022_01/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2022-01-01-preview"; diff --git a/services/mgmt/appplatform/src/package_preview_2022_01/models.rs b/services/mgmt/appplatform/src/package_preview_2022_01/models.rs new file mode 100644 index 0000000000..69933fd9b2 --- /dev/null +++ b/services/mgmt/appplatform/src/package_preview_2022_01/models.rs @@ -0,0 +1,1797 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActiveDeploymentCollection { + #[serde(rename = "activeDeploymentNames", default, skip_serializing_if = "Vec::is_empty")] + pub active_deployment_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddonProfile {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPortalCustomDomainProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPortalCustomDomainResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPortalCustomDomainResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPortalInstance { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPortalProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub public: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "httpsOnly", default, skip_serializing_if = "Option::is_none")] + pub https_only: Option, + #[serde(rename = "gatewayIds", default, skip_serializing_if = "Vec::is_empty")] + pub gateway_ids: Vec, + #[serde(rename = "sourceUrls", default, skip_serializing_if = "Vec::is_empty")] + pub source_urls: Vec, + #[serde(rename = "ssoProperties", default, skip_serializing_if = "Option::is_none")] + pub sso_properties: Option, + #[serde(rename = "resourceRequests", default, skip_serializing_if = "Option::is_none")] + pub resource_requests: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub instances: Vec, +} +pub mod api_portal_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPortalResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPortalResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPortalResourceRequests { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppResourceProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub public: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "addonConfigs", default, skip_serializing_if = "Option::is_none")] + pub addon_configs: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "httpsOnly", default, skip_serializing_if = "Option::is_none")] + pub https_only: Option, + #[serde(rename = "temporaryDisk", default, skip_serializing_if = "Option::is_none")] + pub temporary_disk: Option, + #[serde(rename = "persistentDisk", default, skip_serializing_if = "Option::is_none")] + pub persistent_disk: Option, + #[serde(rename = "customPersistentDisks", default, skip_serializing_if = "Option::is_none")] + pub custom_persistent_disks: Option, + #[serde(rename = "enableEndToEndTLS", default, skip_serializing_if = "Option::is_none")] + pub enable_end_to_end_tls: Option, + #[serde(rename = "loadedCertificates", default, skip_serializing_if = "Option::is_none")] + pub loaded_certificates: Option, +} +pub mod app_resource_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Failed, + Creating, + Updating, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableOperations { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableRuntimeVersions { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileVolume { + #[serde(flatten)] + pub custom_persistent_disk_properties: CustomPersistentDiskProperties, + #[serde(rename = "shareName")] + pub share_name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BindingResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BindingResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BindingResourceProperties { + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub key: Option, + #[serde(rename = "bindingParameters", default, skip_serializing_if = "Option::is_none")] + pub binding_parameters: Option, + #[serde(rename = "generatedProperties", default, skip_serializing_if = "Option::is_none")] + pub generated_properties: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "updatedAt", default, skip_serializing_if = "Option::is_none")] + pub updated_at: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Build { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildProperties { + #[serde(rename = "relativePath", default, skip_serializing_if = "Option::is_none")] + pub relative_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub builder: Option, + #[serde(rename = "agentPool", default, skip_serializing_if = "Option::is_none")] + pub agent_pool: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub env: Option, + #[serde(rename = "triggeredBuildResult", default, skip_serializing_if = "Option::is_none")] + pub triggered_build_result: Option, +} +pub mod build_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildResult { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildResultCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildResultLog { + #[serde(rename = "blobUrl", default, skip_serializing_if = "Option::is_none")] + pub blob_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildResultProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "buildPodName", default, skip_serializing_if = "Option::is_none")] + pub build_pod_name: Option, + #[serde(rename = "buildStages", default, skip_serializing_if = "Vec::is_empty")] + pub build_stages: Vec, +} +pub mod build_result_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Queuing, + Building, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildResultUserSourceInfo { + #[serde(flatten)] + pub user_source_info: UserSourceInfo, + #[serde(rename = "buildResultId", default, skip_serializing_if = "Option::is_none")] + pub build_result_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildService { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildServiceAgentPoolProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "poolSize", default, skip_serializing_if = "Option::is_none")] + pub pool_size: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildServiceAgentPoolResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildServiceAgentPoolResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildServiceAgentPoolSizeProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildServiceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildServiceProperties { + #[serde(rename = "kPackVersion", default, skip_serializing_if = "Option::is_none")] + pub k_pack_version: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "resourceRequests", default, skip_serializing_if = "Option::is_none")] + pub resource_requests: Option, +} +pub mod build_service_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ResourceRequests { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildStageProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod build_stage_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + NotStarted, + Running, + Succeeded, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuilderProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub stack: Option, + #[serde(rename = "buildpackGroups", default, skip_serializing_if = "Vec::is_empty")] + pub buildpack_groups: Vec, +} +pub mod builder_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuilderResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuilderResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildpackBindingLaunchProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secrets: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildpackBindingProperties { + #[serde(rename = "bindingType", default, skip_serializing_if = "Option::is_none")] + pub binding_type: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "launchProperties", default, skip_serializing_if = "Option::is_none")] + pub launch_properties: Option, +} +pub mod buildpack_binding_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BindingType { + ApplicationInsights, + ApacheSkyWalking, + AppDynamics, + Dynatrace, + NewRelic, + #[serde(rename = "ElasticAPM")] + ElasticApm, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildpackBindingResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildpackBindingResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildpackProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BuildpacksGroupProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub buildpacks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateProperties { + #[serde(rename = "type")] + pub type_: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub issuer: Option, + #[serde(rename = "issuedDate", default, skip_serializing_if = "Option::is_none")] + pub issued_date: Option, + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, + #[serde(rename = "activateDate", default, skip_serializing_if = "Option::is_none")] + pub activate_date: Option, + #[serde(rename = "subjectName", default, skip_serializing_if = "Option::is_none")] + pub subject_name: Option, + #[serde(rename = "dnsNames", default, skip_serializing_if = "Vec::is_empty")] + pub dns_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClusterResourceProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "serviceId", default, skip_serializing_if = "Option::is_none")] + pub service_id: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "zoneRedundant", default, skip_serializing_if = "Option::is_none")] + pub zone_redundant: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, +} +pub mod cluster_resource_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Deleted, + Succeeded, + Failed, + Moving, + Moved, + MoveFailed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PowerState { + Running, + Stopped, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigServerGitProperty { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub repositories: Vec, + pub uri: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[serde(rename = "searchPaths", default, skip_serializing_if = "Vec::is_empty")] + pub search_paths: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "hostKey", default, skip_serializing_if = "Option::is_none")] + pub host_key: Option, + #[serde(rename = "hostKeyAlgorithm", default, skip_serializing_if = "Option::is_none")] + pub host_key_algorithm: Option, + #[serde(rename = "privateKey", default, skip_serializing_if = "Option::is_none")] + pub private_key: Option, + #[serde(rename = "strictHostKeyChecking", default, skip_serializing_if = "Option::is_none")] + pub strict_host_key_checking: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigServerProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "configServer", default, skip_serializing_if = "Option::is_none")] + pub config_server: Option, +} +pub mod config_server_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + NotAvailable, + Deleted, + Failed, + Succeeded, + Updating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigServerResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigServerSettings { + #[serde(rename = "gitProperty", default, skip_serializing_if = "Option::is_none")] + pub git_property: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigServerSettingsErrorRecord { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub messages: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigServerSettingsValidateResult { + #[serde(rename = "isValid", default, skip_serializing_if = "Option::is_none")] + pub is_valid: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceGitProperty { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repositories: Option, +} +pub type ConfigurationServiceGitPropertyRepository = Vec; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceGitPropertyValidateResult { + #[serde(rename = "isValid", default, skip_serializing_if = "Option::is_none")] + pub is_valid: Option, + #[serde(rename = "gitReposValidationResult", default, skip_serializing_if = "Vec::is_empty")] + pub git_repos_validation_result: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceGitRepository { + pub name: String, + pub patterns: Vec, + pub uri: String, + pub label: String, + #[serde(rename = "searchPaths", default, skip_serializing_if = "Vec::is_empty")] + pub search_paths: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "hostKey", default, skip_serializing_if = "Option::is_none")] + pub host_key: Option, + #[serde(rename = "hostKeyAlgorithm", default, skip_serializing_if = "Option::is_none")] + pub host_key_algorithm: Option, + #[serde(rename = "privateKey", default, skip_serializing_if = "Option::is_none")] + pub private_key: Option, + #[serde(rename = "strictHostKeyChecking", default, skip_serializing_if = "Option::is_none")] + pub strict_host_key_checking: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceInstance { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "resourceRequests", default, skip_serializing_if = "Option::is_none")] + pub resource_requests: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub instances: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, +} +pub mod configuration_service_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceResourceRequests { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, + #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] + pub instance_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceSettings { + #[serde(rename = "gitProperty", default, skip_serializing_if = "Option::is_none")] + pub git_property: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationServiceSettingsValidateResult { + #[serde(rename = "gitPropertyValidationResult", default, skip_serializing_if = "Option::is_none")] + pub git_property_validation_result: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerProbeSettings { + #[serde(rename = "disableProbe", default, skip_serializing_if = "Option::is_none")] + pub disable_probe: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContentCertificateProperties { + #[serde(flatten)] + pub certificate_properties: CertificateProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomContainer { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub server: Option, + #[serde(rename = "containerImage", default, skip_serializing_if = "Option::is_none")] + pub container_image: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub command: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub args: Vec, + #[serde(rename = "imageRegistryCredential", default, skip_serializing_if = "Option::is_none")] + pub image_registry_credential: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomContainerUserSourceInfo { + #[serde(flatten)] + pub user_source_info: UserSourceInfo, + #[serde(rename = "customContainer", default, skip_serializing_if = "Option::is_none")] + pub custom_container: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, + #[serde(rename = "appName", default, skip_serializing_if = "Option::is_none")] + pub app_name: Option, + #[serde(rename = "certName", default, skip_serializing_if = "Option::is_none")] + pub cert_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainValidatePayload { + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainValidateResult { + #[serde(rename = "isValid", default, skip_serializing_if = "Option::is_none")] + pub is_valid: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +pub type CustomPersistentDiskCollection = Vec; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomPersistentDiskProperties { + #[serde(rename = "type")] + pub type_: custom_persistent_disk_properties::Type, + #[serde(rename = "mountPath")] + pub mount_path: String, + #[serde(rename = "readOnly", default, skip_serializing_if = "Option::is_none")] + pub read_only: Option, + #[serde(rename = "mountOptions", default, skip_serializing_if = "Vec::is_empty")] + pub mount_options: Vec, +} +pub mod custom_persistent_disk_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + AzureFileVolume, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomPersistentDiskResource { + #[serde(rename = "customPersistentDiskProperties", default, skip_serializing_if = "Option::is_none")] + pub custom_persistent_disk_properties: Option, + #[serde(rename = "storageId")] + pub storage_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeploymentInstance { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(rename = "discoveryStatus", default, skip_serializing_if = "Option::is_none")] + pub discovery_status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub zone: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeploymentResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeploymentResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeploymentResourceProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(rename = "deploymentSettings", default, skip_serializing_if = "Option::is_none")] + pub deployment_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub active: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub instances: Vec, +} +pub mod deployment_resource_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Stopped, + Running, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeploymentSettings { + #[serde(rename = "resourceRequests", default, skip_serializing_if = "Option::is_none")] + pub resource_requests: Option, + #[serde(rename = "environmentVariables", default, skip_serializing_if = "Option::is_none")] + pub environment_variables: Option, + #[serde(rename = "addonConfigs", default, skip_serializing_if = "Option::is_none")] + pub addon_configs: Option, + #[serde(rename = "containerProbeSettings", default, skip_serializing_if = "Option::is_none")] + pub container_probe_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiagnosticParameters { + #[serde(rename = "appInstance", default, skip_serializing_if = "Option::is_none")] + pub app_instance: Option, + #[serde(rename = "filePath", default, skip_serializing_if = "Option::is_none")] + pub file_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Error { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayApiMetadataProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub documentation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "serverUrl", default, skip_serializing_if = "Option::is_none")] + pub server_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayApiRoute { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, + #[serde(rename = "ssoEnabled", default, skip_serializing_if = "Option::is_none")] + pub sso_enabled: Option, + #[serde(rename = "tokenRelay", default, skip_serializing_if = "Option::is_none")] + pub token_relay: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub predicates: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub filters: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub order: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tags: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayCorsProperties { + #[serde(rename = "allowedOrigins", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_origins: Vec, + #[serde(rename = "allowedMethods", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_methods: Vec, + #[serde(rename = "allowedHeaders", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_headers: Vec, + #[serde(rename = "maxAge", default, skip_serializing_if = "Option::is_none")] + pub max_age: Option, + #[serde(rename = "allowCredentials", default, skip_serializing_if = "Option::is_none")] + pub allow_credentials: Option, + #[serde(rename = "exposedHeaders", default, skip_serializing_if = "Vec::is_empty")] + pub exposed_headers: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayCustomDomainProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayCustomDomainResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayCustomDomainResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayInstance { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayOperatorProperties { + #[serde(rename = "resourceRequests", default, skip_serializing_if = "Option::is_none")] + pub resource_requests: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub instances: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayOperatorResourceRequests { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, + #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] + pub instance_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub public: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "httpsOnly", default, skip_serializing_if = "Option::is_none")] + pub https_only: Option, + #[serde(rename = "ssoProperties", default, skip_serializing_if = "Option::is_none")] + pub sso_properties: Option, + #[serde(rename = "apiMetadataProperties", default, skip_serializing_if = "Option::is_none")] + pub api_metadata_properties: Option, + #[serde(rename = "corsProperties", default, skip_serializing_if = "Option::is_none")] + pub cors_properties: Option, + #[serde(rename = "resourceRequests", default, skip_serializing_if = "Option::is_none")] + pub resource_requests: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub instances: Vec, + #[serde(rename = "operatorProperties", default, skip_serializing_if = "Option::is_none")] + pub operator_properties: Option, +} +pub mod gateway_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayResourceRequests { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayRouteConfigProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "appResourceId", default, skip_serializing_if = "Option::is_none")] + pub app_resource_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub routes: Vec, +} +pub mod gateway_route_config_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayRouteConfigResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayRouteConfigResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GitPatternRepository { + pub name: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub pattern: Vec, + pub uri: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[serde(rename = "searchPaths", default, skip_serializing_if = "Vec::is_empty")] + pub search_paths: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "hostKey", default, skip_serializing_if = "Option::is_none")] + pub host_key: Option, + #[serde(rename = "hostKeyAlgorithm", default, skip_serializing_if = "Option::is_none")] + pub host_key_algorithm: Option, + #[serde(rename = "privateKey", default, skip_serializing_if = "Option::is_none")] + pub private_key: Option, + #[serde(rename = "strictHostKeyChecking", default, skip_serializing_if = "Option::is_none")] + pub strict_host_key_checking: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageRegistryCredential { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JarUploadedUserSourceInfo { + #[serde(flatten)] + pub uploaded_user_source_info: UploadedUserSourceInfo, + #[serde(rename = "runtimeVersion", default, skip_serializing_if = "Option::is_none")] + pub runtime_version: Option, + #[serde(rename = "jvmOptions", default, skip_serializing_if = "Option::is_none")] + pub jvm_options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultCertificateProperties { + #[serde(flatten)] + pub certificate_properties: CertificateProperties, + #[serde(rename = "vaultUri")] + pub vault_uri: String, + #[serde(rename = "keyVaultCertName")] + pub key_vault_cert_name: String, + #[serde(rename = "certVersion", default, skip_serializing_if = "Option::is_none")] + pub cert_version: Option, + #[serde(rename = "excludePrivateKey", default, skip_serializing_if = "Option::is_none")] + pub exclude_private_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadedCertificate { + #[serde(rename = "resourceId")] + pub resource_id: String, + #[serde(rename = "loadTrustStore", default, skip_serializing_if = "Option::is_none")] + pub load_trust_store: Option, +} +pub type LoadedCertificateCollection = Vec; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogFileUrlResponse { + pub url: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedIdentityProperties { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +pub mod managed_identity_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + None, + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned,UserAssigned")] + SystemAssignedUserAssigned, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricDimension { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "toBeExportedForShoebox", default, skip_serializing_if = "Option::is_none")] + pub to_be_exported_for_shoebox: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[serde(rename = "supportedAggregationTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_aggregation_types: Vec, + #[serde(rename = "supportedTimeGrainTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_time_grain_types: Vec, + #[serde(rename = "fillGapWithZero", default, skip_serializing_if = "Option::is_none")] + pub fill_gap_with_zero: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dimensions: Vec, + #[serde(rename = "sourceMdmNamespace", default, skip_serializing_if = "Option::is_none")] + pub source_mdm_namespace: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringSettingProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "traceEnabled", default, skip_serializing_if = "Option::is_none")] + pub trace_enabled: Option, + #[serde(rename = "appInsightsInstrumentationKey", default, skip_serializing_if = "Option::is_none")] + pub app_insights_instrumentation_key: Option, + #[serde(rename = "appInsightsSamplingRate", default, skip_serializing_if = "Option::is_none")] + pub app_insights_sampling_rate: Option, + #[serde(rename = "appInsightsAgentVersions", default, skip_serializing_if = "Option::is_none")] + pub app_insights_agent_versions: Option, +} +pub mod monitoring_setting_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + NotAvailable, + Failed, + Succeeded, + Updating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringSettingResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NameAvailability { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NameAvailabilityParameters { + #[serde(rename = "type")] + pub type_: String, + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetCoreZipUploadedUserSourceInfo { + #[serde(flatten)] + pub uploaded_user_source_info: UploadedUserSourceInfo, + #[serde(rename = "netCoreMainEntryPath", default, skip_serializing_if = "Option::is_none")] + pub net_core_main_entry_path: Option, + #[serde(rename = "runtimeVersion", default, skip_serializing_if = "Option::is_none")] + pub runtime_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkProfile { + #[serde(rename = "serviceRuntimeSubnetId", default, skip_serializing_if = "Option::is_none")] + pub service_runtime_subnet_id: Option, + #[serde(rename = "appSubnetId", default, skip_serializing_if = "Option::is_none")] + pub app_subnet_id: Option, + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, + #[serde(rename = "serviceRuntimeNetworkResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub service_runtime_network_resource_group: Option, + #[serde(rename = "appNetworkResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub app_network_resource_group: Option, + #[serde(rename = "outboundIPs", default, skip_serializing_if = "Option::is_none")] + pub outbound_i_ps: Option, + #[serde(rename = "requiredTraffics", default, skip_serializing_if = "Vec::is_empty")] + pub required_traffics: Vec, +} +pub mod network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIPs { + #[serde(rename = "publicIPs", default, skip_serializing_if = "Vec::is_empty")] + pub public_i_ps: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationProperties { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PersistentDisk { + #[serde(rename = "sizeInGB", default, skip_serializing_if = "Option::is_none")] + pub size_in_gb: Option, + #[serde(rename = "usedInGB", default, skip_serializing_if = "Option::is_none")] + pub used_in_gb: Option, + #[serde(rename = "mountPath", default, skip_serializing_if = "Option::is_none")] + pub mount_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegenerateTestKeyRequestPayload { + #[serde(rename = "keyType")] + pub key_type: regenerate_test_key_request_payload::KeyType, +} +pub mod regenerate_test_key_request_payload { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyType { + Primary, + Secondary, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RequiredTraffic { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ips: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub fqdns: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub direction: Option, +} +pub mod required_traffic { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Direction { + Inbound, + Outbound, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceRequests { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSku { + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[serde(rename = "locationInfo", default, skip_serializing_if = "Vec::is_empty")] + pub location_info: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub restrictions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuCapabilities { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuLocationInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "zoneDetails", default, skip_serializing_if = "Vec::is_empty")] + pub zone_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuRestrictionInfo { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuRestrictions { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, + #[serde(rename = "restrictionInfo", default, skip_serializing_if = "Option::is_none")] + pub restriction_info: Option, + #[serde(rename = "reasonCode", default, skip_serializing_if = "Option::is_none")] + pub reason_code: Option, +} +pub mod resource_sku_restrictions { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Location, + Zone, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ReasonCode { + QuotaId, + NotAvailableForSubscription, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuZoneDetails { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub name: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceUploadDefinition { + #[serde(rename = "relativePath", default, skip_serializing_if = "Option::is_none")] + pub relative_path: Option, + #[serde(rename = "uploadUrl", default, skip_serializing_if = "Option::is_none")] + pub upload_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceRegistryInstance { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceRegistryProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "resourceRequests", default, skip_serializing_if = "Option::is_none")] + pub resource_requests: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub instances: Vec, +} +pub mod service_registry_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceRegistryResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceRegistryResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceRegistryResourceRequests { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, + #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] + pub instance_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceResource { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceResourceList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceSpecification { + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SkuCapacity { + pub minimum: i32, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maximum: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, + #[serde(rename = "scaleType", default, skip_serializing_if = "Option::is_none")] + pub scale_type: Option, +} +pub mod sku_capacity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScaleType { + None, + Manual, + Automatic, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceUploadedUserSourceInfo { + #[serde(flatten)] + pub uploaded_user_source_info: UploadedUserSourceInfo, + #[serde(rename = "artifactSelector", default, skip_serializing_if = "Option::is_none")] + pub artifact_selector: Option, + #[serde(rename = "runtimeVersion", default, skip_serializing_if = "Option::is_none")] + pub runtime_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SsoProperties { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub scope: Vec, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[serde(rename = "issuerUri", default, skip_serializing_if = "Option::is_none")] + pub issuer_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StackProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccount { + #[serde(flatten)] + pub storage_properties: StorageProperties, + #[serde(rename = "accountName")] + pub account_name: String, + #[serde(rename = "accountKey")] + pub account_key: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageProperties { + #[serde(rename = "storageType")] + pub storage_type: storage_properties::StorageType, +} +pub mod storage_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageType { + StorageAccount, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedBuildpackResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedBuildpackResourceProperties { + #[serde(rename = "buildpackId", default, skip_serializing_if = "Option::is_none")] + pub buildpack_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedBuildpacksCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedRuntimeVersion { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub platform: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +pub mod supported_runtime_version { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Value { + #[serde(rename = "Java_8")] + Java8, + #[serde(rename = "Java_11")] + Java11, + #[serde(rename = "Java_17")] + Java17, + #[serde(rename = "NetCore_31")] + NetCore31, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Platform { + Java, + #[serde(rename = ".NET Core")] + NetCore, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedStackResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedStackResourceProperties { + #[serde(rename = "stackId", default, skip_serializing_if = "Option::is_none")] + pub stack_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedStacksCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TemporaryDisk { + #[serde(rename = "sizeInGB", default, skip_serializing_if = "Option::is_none")] + pub size_in_gb: Option, + #[serde(rename = "mountPath", default, skip_serializing_if = "Option::is_none")] + pub mount_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestKeys { + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, + #[serde(rename = "primaryTestEndpoint", default, skip_serializing_if = "Option::is_none")] + pub primary_test_endpoint: Option, + #[serde(rename = "secondaryTestEndpoint", default, skip_serializing_if = "Option::is_none")] + pub secondary_test_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggeredBuildResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UploadedUserSourceInfo { + #[serde(flatten)] + pub user_source_info: UserSourceInfo, + #[serde(rename = "relativePath", default, skip_serializing_if = "Option::is_none")] + pub relative_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserSourceInfo { + #[serde(rename = "type")] + pub type_: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidationMessages { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub messages: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationInsightsAgentVersions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub java: Option, +} diff --git a/services/mgmt/appplatform/src/package_preview_2022_01/operations.rs b/services/mgmt/appplatform/src/package_preview_2022_01/operations.rs new file mode 100644 index 0000000000..af7cc943a5 --- /dev/null +++ b/services/mgmt/appplatform/src/package_preview_2022_01/operations.rs @@ -0,0 +1,12075 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn api_portal_custom_domains(&self) -> api_portal_custom_domains::Client { + api_portal_custom_domains::Client(self.clone()) + } + pub fn api_portals(&self) -> api_portals::Client { + api_portals::Client(self.clone()) + } + pub fn apps(&self) -> apps::Client { + apps::Client(self.clone()) + } + pub fn bindings(&self) -> bindings::Client { + bindings::Client(self.clone()) + } + pub fn build_service(&self) -> build_service::Client { + build_service::Client(self.clone()) + } + pub fn build_service_agent_pool(&self) -> build_service_agent_pool::Client { + build_service_agent_pool::Client(self.clone()) + } + pub fn build_service_builder(&self) -> build_service_builder::Client { + build_service_builder::Client(self.clone()) + } + pub fn buildpack_binding(&self) -> buildpack_binding::Client { + buildpack_binding::Client(self.clone()) + } + pub fn certificates(&self) -> certificates::Client { + certificates::Client(self.clone()) + } + pub fn config_servers(&self) -> config_servers::Client { + config_servers::Client(self.clone()) + } + pub fn configuration_services(&self) -> configuration_services::Client { + configuration_services::Client(self.clone()) + } + pub fn custom_domains(&self) -> custom_domains::Client { + custom_domains::Client(self.clone()) + } + pub fn deployments(&self) -> deployments::Client { + deployments::Client(self.clone()) + } + pub fn gateway_custom_domains(&self) -> gateway_custom_domains::Client { + gateway_custom_domains::Client(self.clone()) + } + pub fn gateway_route_configs(&self) -> gateway_route_configs::Client { + gateway_route_configs::Client(self.clone()) + } + pub fn gateways(&self) -> gateways::Client { + gateways::Client(self.clone()) + } + pub fn monitoring_settings(&self) -> monitoring_settings::Client { + monitoring_settings::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn runtime_versions(&self) -> runtime_versions::Client { + runtime_versions::Client(self.clone()) + } + pub fn service_registries(&self) -> service_registries::Client { + service_registries::Client(self.clone()) + } + pub fn services(&self) -> services::Client { + services::Client(self.clone()) + } + pub fn skus(&self) -> skus::Client { + skus::Client(self.clone()) + } + pub fn storages(&self) -> storages::Client { + storages::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Services_Get(#[from] services::get::Error), + #[error(transparent)] + Services_CreateOrUpdate(#[from] services::create_or_update::Error), + #[error(transparent)] + Services_Update(#[from] services::update::Error), + #[error(transparent)] + Services_Delete(#[from] services::delete::Error), + #[error(transparent)] + Services_ListTestKeys(#[from] services::list_test_keys::Error), + #[error(transparent)] + Services_RegenerateTestKey(#[from] services::regenerate_test_key::Error), + #[error(transparent)] + Services_DisableTestEndpoint(#[from] services::disable_test_endpoint::Error), + #[error(transparent)] + Services_EnableTestEndpoint(#[from] services::enable_test_endpoint::Error), + #[error(transparent)] + Services_Stop(#[from] services::stop::Error), + #[error(transparent)] + Services_Start(#[from] services::start::Error), + #[error(transparent)] + ConfigServers_Get(#[from] config_servers::get::Error), + #[error(transparent)] + ConfigServers_UpdatePut(#[from] config_servers::update_put::Error), + #[error(transparent)] + ConfigServers_UpdatePatch(#[from] config_servers::update_patch::Error), + #[error(transparent)] + ConfigServers_Validate(#[from] config_servers::validate::Error), + #[error(transparent)] + ConfigurationServices_Get(#[from] configuration_services::get::Error), + #[error(transparent)] + ConfigurationServices_CreateOrUpdate(#[from] configuration_services::create_or_update::Error), + #[error(transparent)] + ConfigurationServices_Delete(#[from] configuration_services::delete::Error), + #[error(transparent)] + ConfigurationServices_List(#[from] configuration_services::list::Error), + #[error(transparent)] + ConfigurationServices_Validate(#[from] configuration_services::validate::Error), + #[error(transparent)] + ServiceRegistries_Get(#[from] service_registries::get::Error), + #[error(transparent)] + ServiceRegistries_CreateOrUpdate(#[from] service_registries::create_or_update::Error), + #[error(transparent)] + ServiceRegistries_Delete(#[from] service_registries::delete::Error), + #[error(transparent)] + ServiceRegistries_List(#[from] service_registries::list::Error), + #[error(transparent)] + BuildService_ListBuildServices(#[from] build_service::list_build_services::Error), + #[error(transparent)] + BuildService_GetBuildService(#[from] build_service::get_build_service::Error), + #[error(transparent)] + BuildService_ListBuilds(#[from] build_service::list_builds::Error), + #[error(transparent)] + BuildService_GetBuild(#[from] build_service::get_build::Error), + #[error(transparent)] + BuildService_CreateOrUpdateBuild(#[from] build_service::create_or_update_build::Error), + #[error(transparent)] + BuildpackBinding_Get(#[from] buildpack_binding::get::Error), + #[error(transparent)] + BuildpackBinding_CreateOrUpdate(#[from] buildpack_binding::create_or_update::Error), + #[error(transparent)] + BuildpackBinding_Delete(#[from] buildpack_binding::delete::Error), + #[error(transparent)] + BuildpackBinding_List(#[from] buildpack_binding::list::Error), + #[error(transparent)] + BuildService_ListBuildResults(#[from] build_service::list_build_results::Error), + #[error(transparent)] + BuildService_GetBuildResult(#[from] build_service::get_build_result::Error), + #[error(transparent)] + BuildService_GetBuildResultLog(#[from] build_service::get_build_result_log::Error), + #[error(transparent)] + BuildServiceBuilder_Get(#[from] build_service_builder::get::Error), + #[error(transparent)] + BuildServiceBuilder_CreateOrUpdate(#[from] build_service_builder::create_or_update::Error), + #[error(transparent)] + BuildServiceBuilder_Delete(#[from] build_service_builder::delete::Error), + #[error(transparent)] + BuildServiceBuilder_List(#[from] build_service_builder::list::Error), + #[error(transparent)] + BuildService_GetResourceUploadUrl(#[from] build_service::get_resource_upload_url::Error), + #[error(transparent)] + BuildService_ListSupportedBuildpacks(#[from] build_service::list_supported_buildpacks::Error), + #[error(transparent)] + BuildService_GetSupportedBuildpack(#[from] build_service::get_supported_buildpack::Error), + #[error(transparent)] + BuildService_ListSupportedStacks(#[from] build_service::list_supported_stacks::Error), + #[error(transparent)] + BuildService_GetSupportedStack(#[from] build_service::get_supported_stack::Error), + #[error(transparent)] + BuildServiceAgentPool_List(#[from] build_service_agent_pool::list::Error), + #[error(transparent)] + BuildServiceAgentPool_Get(#[from] build_service_agent_pool::get::Error), + #[error(transparent)] + BuildServiceAgentPool_UpdatePut(#[from] build_service_agent_pool::update_put::Error), + #[error(transparent)] + MonitoringSettings_Get(#[from] monitoring_settings::get::Error), + #[error(transparent)] + MonitoringSettings_UpdatePut(#[from] monitoring_settings::update_put::Error), + #[error(transparent)] + MonitoringSettings_UpdatePatch(#[from] monitoring_settings::update_patch::Error), + #[error(transparent)] + Apps_Get(#[from] apps::get::Error), + #[error(transparent)] + Apps_CreateOrUpdate(#[from] apps::create_or_update::Error), + #[error(transparent)] + Apps_Update(#[from] apps::update::Error), + #[error(transparent)] + Apps_Delete(#[from] apps::delete::Error), + #[error(transparent)] + Apps_List(#[from] apps::list::Error), + #[error(transparent)] + Apps_GetResourceUploadUrl(#[from] apps::get_resource_upload_url::Error), + #[error(transparent)] + Apps_SetActiveDeployments(#[from] apps::set_active_deployments::Error), + #[error(transparent)] + Bindings_Get(#[from] bindings::get::Error), + #[error(transparent)] + Bindings_CreateOrUpdate(#[from] bindings::create_or_update::Error), + #[error(transparent)] + Bindings_Update(#[from] bindings::update::Error), + #[error(transparent)] + Bindings_Delete(#[from] bindings::delete::Error), + #[error(transparent)] + Bindings_List(#[from] bindings::list::Error), + #[error(transparent)] + Storages_Get(#[from] storages::get::Error), + #[error(transparent)] + Storages_CreateOrUpdate(#[from] storages::create_or_update::Error), + #[error(transparent)] + Storages_Delete(#[from] storages::delete::Error), + #[error(transparent)] + Storages_List(#[from] storages::list::Error), + #[error(transparent)] + Certificates_Get(#[from] certificates::get::Error), + #[error(transparent)] + Certificates_CreateOrUpdate(#[from] certificates::create_or_update::Error), + #[error(transparent)] + Certificates_Delete(#[from] certificates::delete::Error), + #[error(transparent)] + Certificates_List(#[from] certificates::list::Error), + #[error(transparent)] + Services_CheckNameAvailability(#[from] services::check_name_availability::Error), + #[error(transparent)] + CustomDomains_Get(#[from] custom_domains::get::Error), + #[error(transparent)] + CustomDomains_CreateOrUpdate(#[from] custom_domains::create_or_update::Error), + #[error(transparent)] + CustomDomains_Update(#[from] custom_domains::update::Error), + #[error(transparent)] + CustomDomains_Delete(#[from] custom_domains::delete::Error), + #[error(transparent)] + CustomDomains_List(#[from] custom_domains::list::Error), + #[error(transparent)] + Apps_ValidateDomain(#[from] apps::validate_domain::Error), + #[error(transparent)] + Deployments_Get(#[from] deployments::get::Error), + #[error(transparent)] + Deployments_CreateOrUpdate(#[from] deployments::create_or_update::Error), + #[error(transparent)] + Deployments_Update(#[from] deployments::update::Error), + #[error(transparent)] + Deployments_Delete(#[from] deployments::delete::Error), + #[error(transparent)] + Deployments_List(#[from] deployments::list::Error), + #[error(transparent)] + Deployments_ListForCluster(#[from] deployments::list_for_cluster::Error), + #[error(transparent)] + Deployments_Start(#[from] deployments::start::Error), + #[error(transparent)] + Deployments_Stop(#[from] deployments::stop::Error), + #[error(transparent)] + Deployments_Restart(#[from] deployments::restart::Error), + #[error(transparent)] + Deployments_GetLogFileUrl(#[from] deployments::get_log_file_url::Error), + #[error(transparent)] + Deployments_GenerateHeapDump(#[from] deployments::generate_heap_dump::Error), + #[error(transparent)] + Deployments_GenerateThreadDump(#[from] deployments::generate_thread_dump::Error), + #[error(transparent)] + Deployments_StartJfr(#[from] deployments::start_jfr::Error), + #[error(transparent)] + Services_ListBySubscription(#[from] services::list_by_subscription::Error), + #[error(transparent)] + Services_List(#[from] services::list::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + RuntimeVersions_ListRuntimeVersions(#[from] runtime_versions::list_runtime_versions::Error), + #[error(transparent)] + Skus_List(#[from] skus::list::Error), + #[error(transparent)] + Gateways_Get(#[from] gateways::get::Error), + #[error(transparent)] + Gateways_CreateOrUpdate(#[from] gateways::create_or_update::Error), + #[error(transparent)] + Gateways_Delete(#[from] gateways::delete::Error), + #[error(transparent)] + Gateways_List(#[from] gateways::list::Error), + #[error(transparent)] + GatewayRouteConfigs_Get(#[from] gateway_route_configs::get::Error), + #[error(transparent)] + GatewayRouteConfigs_CreateOrUpdate(#[from] gateway_route_configs::create_or_update::Error), + #[error(transparent)] + GatewayRouteConfigs_Delete(#[from] gateway_route_configs::delete::Error), + #[error(transparent)] + GatewayRouteConfigs_List(#[from] gateway_route_configs::list::Error), + #[error(transparent)] + GatewayCustomDomains_Get(#[from] gateway_custom_domains::get::Error), + #[error(transparent)] + GatewayCustomDomains_CreateOrUpdate(#[from] gateway_custom_domains::create_or_update::Error), + #[error(transparent)] + GatewayCustomDomains_Delete(#[from] gateway_custom_domains::delete::Error), + #[error(transparent)] + GatewayCustomDomains_List(#[from] gateway_custom_domains::list::Error), + #[error(transparent)] + Gateways_ValidateDomain(#[from] gateways::validate_domain::Error), + #[error(transparent)] + ApiPortals_Get(#[from] api_portals::get::Error), + #[error(transparent)] + ApiPortals_CreateOrUpdate(#[from] api_portals::create_or_update::Error), + #[error(transparent)] + ApiPortals_Delete(#[from] api_portals::delete::Error), + #[error(transparent)] + ApiPortals_List(#[from] api_portals::list::Error), + #[error(transparent)] + ApiPortalCustomDomains_Get(#[from] api_portal_custom_domains::get::Error), + #[error(transparent)] + ApiPortalCustomDomains_CreateOrUpdate(#[from] api_portal_custom_domains::create_or_update::Error), + #[error(transparent)] + ApiPortalCustomDomains_Delete(#[from] api_portal_custom_domains::delete::Error), + #[error(transparent)] + ApiPortalCustomDomains_List(#[from] api_portal_custom_domains::list::Error), + #[error(transparent)] + ApiPortals_ValidateDomain(#[from] api_portals::validate_domain::Error), +} +pub mod services { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + resource: resource.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + resource: resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn list_test_keys( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_test_keys::Builder { + list_test_keys::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn regenerate_test_key( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + regenerate_test_key_request: impl Into, + ) -> regenerate_test_key::Builder { + regenerate_test_key::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + regenerate_test_key_request: regenerate_test_key_request.into(), + } + } + pub fn disable_test_endpoint( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> disable_test_endpoint::Builder { + disable_test_endpoint::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn enable_test_endpoint( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> enable_test_endpoint::Builder { + enable_test_endpoint::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn check_name_availability( + &self, + subscription_id: impl Into, + location: impl Into, + availability_parameters: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + availability_parameters: availability_parameters.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into, resource_group_name: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ServiceResource), + Created201(models::ServiceResource), + Accepted202(models::ServiceResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) resource: models::ServiceResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ServiceResource), + Accepted202(models::ServiceResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) resource: models::ServiceResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_test_keys { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/listTestKeys", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TestKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_test_key { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) regenerate_test_key_request: models::RegenerateTestKeyRequestPayload, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/regenerateTestKey", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.regenerate_test_key_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TestKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod disable_test_endpoint { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/disableTestEndpoint", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod enable_test_endpoint { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/enableTestEndpoint", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TestKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Error response #response_type")] + Conflict409 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::CONFLICT => Err(Error::Conflict409 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Error response #response_type")] + Conflict409 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::CONFLICT => Err(Error::Conflict409 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) availability_parameters: models::NameAvailabilityParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AppPlatform/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.availability_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NameAvailability = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AppPlatform/Spring", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod config_servers { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn update_put( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + config_server_resource: impl Into, + ) -> update_put::Builder { + update_put::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + config_server_resource: config_server_resource.into(), + } + } + pub fn update_patch( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + config_server_resource: impl Into, + ) -> update_patch::Builder { + update_patch::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + config_server_resource: config_server_resource.into(), + } + } + pub fn validate( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + config_server_settings: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + config_server_settings: config_server_settings.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configServers/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigServerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_put { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConfigServerResource), + Accepted202(models::ConfigServerResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) config_server_resource: models::ConfigServerResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configServers/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.config_server_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigServerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigServerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_patch { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConfigServerResource), + Accepted202(models::ConfigServerResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) config_server_resource: models::ConfigServerResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configServers/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.config_server_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigServerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigServerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConfigServerSettingsValidateResult), + Accepted202(models::ConfigServerSettingsValidateResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) config_server_settings: models::ConfigServerSettings, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configServers/validate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.config_server_settings).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigServerSettingsValidateResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigServerSettingsValidateResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod configuration_services { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + configuration_service_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + configuration_service_name: configuration_service_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + configuration_service_name: impl Into, + configuration_service_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + configuration_service_name: configuration_service_name.into(), + configuration_service_resource: configuration_service_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + configuration_service_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + configuration_service_name: configuration_service_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn validate( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + configuration_service_name: impl Into, + settings: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + configuration_service_name: configuration_service_name.into(), + settings: settings.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) configuration_service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configurationServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.configuration_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigurationServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConfigurationServiceResource), + Created201(models::ConfigurationServiceResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) configuration_service_name: String, + pub(crate) configuration_service_resource: models::ConfigurationServiceResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configurationServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.configuration_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.configuration_service_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigurationServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigurationServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) configuration_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configurationServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.configuration_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configurationServices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigurationServiceResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConfigurationServiceSettingsValidateResult), + Accepted202(models::ConfigurationServiceSettingsValidateResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) configuration_service_name: String, + pub(crate) settings: models::ConfigurationServiceSettings, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/configurationServices/{}/validate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.configuration_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.settings).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigurationServiceSettingsValidateResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConfigurationServiceSettingsValidateResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod service_registries { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + service_registry_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + service_registry_name: service_registry_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + service_registry_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + service_registry_name: service_registry_name.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + service_registry_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + service_registry_name: service_registry_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) service_registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/serviceRegistries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.service_registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceRegistryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ServiceRegistryResource), + Created201(models::ServiceRegistryResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) service_registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/serviceRegistries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.service_registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceRegistryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceRegistryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) service_registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/serviceRegistries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.service_registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/serviceRegistries", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceRegistryResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod build_service { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_build_services( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_build_services::Builder { + list_build_services::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn get_build_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + ) -> get_build_service::Builder { + get_build_service::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + } + } + pub fn list_builds( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + ) -> list_builds::Builder { + list_builds::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + } + } + pub fn get_build( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + build_name: impl Into, + ) -> get_build::Builder { + get_build::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + build_name: build_name.into(), + } + } + pub fn create_or_update_build( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + build_name: impl Into, + build: impl Into, + ) -> create_or_update_build::Builder { + create_or_update_build::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + build_name: build_name.into(), + build: build.into(), + } + } + pub fn list_build_results( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + build_name: impl Into, + ) -> list_build_results::Builder { + list_build_results::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + build_name: build_name.into(), + } + } + pub fn get_build_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + build_name: impl Into, + build_result_name: impl Into, + ) -> get_build_result::Builder { + get_build_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + build_name: build_name.into(), + build_result_name: build_result_name.into(), + } + } + pub fn get_build_result_log( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + build_name: impl Into, + build_result_name: impl Into, + ) -> get_build_result_log::Builder { + get_build_result_log::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + build_name: build_name.into(), + build_result_name: build_result_name.into(), + } + } + pub fn get_resource_upload_url( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + ) -> get_resource_upload_url::Builder { + get_resource_upload_url::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + } + } + pub fn list_supported_buildpacks( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + ) -> list_supported_buildpacks::Builder { + list_supported_buildpacks::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + } + } + pub fn get_supported_buildpack( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + buildpack_name: impl Into, + ) -> get_supported_buildpack::Builder { + get_supported_buildpack::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + buildpack_name: buildpack_name.into(), + } + } + pub fn list_supported_stacks( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + ) -> list_supported_stacks::Builder { + list_supported_stacks::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + } + } + pub fn get_supported_stack( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + stack_name: impl Into, + ) -> get_supported_stack::Builder { + get_supported_stack::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + stack_name: stack_name.into(), + } + } + } + pub mod list_build_services { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildServiceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_build_service { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_builds { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builds", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_build { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) build_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builds/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name, + &self.build_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Build = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_build { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Build), + Created201(models::Build), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) build_name: String, + pub(crate) build: models::Build, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builds/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name, + &self.build_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.build).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Build = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Build = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_build_results { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) build_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builds/{}/results" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . build_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildResultCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_build_result { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) build_name: String, + pub(crate) build_result_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builds/{}/results/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . build_name , & self . build_result_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_build_result_log { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) build_name: String, + pub(crate) build_result_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builds/{}/results/{}/getLogFileUrl" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . build_name , & self . build_result_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildResultLog = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_resource_upload_url { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/getResourceUploadUrl" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceUploadDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_supported_buildpacks { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/supportedBuildpacks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SupportedBuildpacksCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_supported_buildpack { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) buildpack_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/supportedBuildpacks/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . buildpack_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SupportedBuildpackResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_supported_stacks { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/supportedStacks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SupportedStacksCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_supported_stack { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) stack_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/supportedStacks/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . stack_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SupportedStackResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod buildpack_binding { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + builder_name: impl Into, + buildpack_binding_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + builder_name: builder_name.into(), + buildpack_binding_name: buildpack_binding_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + builder_name: impl Into, + buildpack_binding_name: impl Into, + buildpack_binding: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + builder_name: builder_name.into(), + buildpack_binding_name: buildpack_binding_name.into(), + buildpack_binding: buildpack_binding.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + builder_name: impl Into, + buildpack_binding_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + builder_name: builder_name.into(), + buildpack_binding_name: buildpack_binding_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + builder_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + builder_name: builder_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) builder_name: String, + pub(crate) buildpack_binding_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builders/{}/buildpackBindings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . builder_name , & self . buildpack_binding_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildpackBindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BuildpackBindingResource), + Created201(models::BuildpackBindingResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) builder_name: String, + pub(crate) buildpack_binding_name: String, + pub(crate) buildpack_binding: models::BuildpackBindingResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builders/{}/buildpackBindings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . builder_name , & self . buildpack_binding_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.buildpack_binding).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildpackBindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildpackBindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) builder_name: String, + pub(crate) buildpack_binding_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builders/{}/buildpackBindings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . builder_name , & self . buildpack_binding_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) builder_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builders/{}/buildpackBindings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . build_service_name , & self . builder_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildpackBindingResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod build_service_builder { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + builder_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + builder_name: builder_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + builder_name: impl Into, + builder_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + builder_name: builder_name.into(), + builder_resource: builder_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + builder_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + builder_name: builder_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) builder_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name, + &self.builder_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuilderResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BuilderResource), + Created201(models::BuilderResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) builder_name: String, + pub(crate) builder_resource: models::BuilderResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name, + &self.builder_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.builder_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuilderResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuilderResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) builder_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name, + &self.builder_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/builders", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuilderResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod build_service_agent_pool { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + pub fn update_put( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + build_service_name: impl Into, + agent_pool_name: impl Into, + agent_pool_resource: impl Into, + ) -> update_put::Builder { + update_put::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + build_service_name: build_service_name.into(), + agent_pool_name: agent_pool_name.into(), + agent_pool_resource: agent_pool_resource.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildServiceAgentPoolResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildServiceAgentPoolResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_put { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BuildServiceAgentPoolResource), + Created201(models::BuildServiceAgentPoolResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) build_service_name: String, + pub(crate) agent_pool_name: String, + pub(crate) agent_pool_resource: models::BuildServiceAgentPoolResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/buildServices/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.build_service_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.agent_pool_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildServiceAgentPoolResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BuildServiceAgentPoolResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod monitoring_settings { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn update_put( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + monitoring_setting_resource: impl Into, + ) -> update_put::Builder { + update_put::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + monitoring_setting_resource: monitoring_setting_resource.into(), + } + } + pub fn update_patch( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + monitoring_setting_resource: impl Into, + ) -> update_patch::Builder { + update_patch::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + monitoring_setting_resource: monitoring_setting_resource.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/monitoringSettings/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringSettingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_put { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MonitoringSettingResource), + Accepted202(models::MonitoringSettingResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) monitoring_setting_resource: models::MonitoringSettingResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/monitoringSettings/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.monitoring_setting_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringSettingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringSettingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_patch { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MonitoringSettingResource), + Accepted202(models::MonitoringSettingResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) monitoring_setting_resource: models::MonitoringSettingResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/monitoringSettings/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.monitoring_setting_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringSettingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringSettingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod apps { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + sync_status: None, + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + app_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + app_resource: app_resource.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + app_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + app_resource: app_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn get_resource_upload_url( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + ) -> get_resource_upload_url::Builder { + get_resource_upload_url::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + } + } + pub fn set_active_deployments( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + active_deployment_collection: impl Into, + ) -> set_active_deployments::Builder { + set_active_deployments::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + active_deployment_collection: active_deployment_collection.into(), + } + } + pub fn validate_domain( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + validate_payload: impl Into, + ) -> validate_domain::Builder { + validate_domain::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + validate_payload: validate_payload.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) sync_status: Option, + } + impl Builder { + pub fn sync_status(mut self, sync_status: impl Into) -> Self { + self.sync_status = Some(sync_status.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(sync_status) = &self.sync_status { + url.query_pairs_mut().append_pair("syncStatus", sync_status); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AppResource), + Created201(models::AppResource), + Accepted202(models::AppResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) app_resource: models::AppResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.app_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AppResource), + Accepted202(models::AppResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) app_resource: models::AppResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.app_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_resource_upload_url { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/getResourceUploadUrl", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceUploadDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod set_active_deployments { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AppResource), + Accepted202(models::AppResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) active_deployment_collection: models::ActiveDeploymentCollection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/setActiveDeployments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.active_deployment_collection).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_domain { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) validate_payload: models::CustomDomainValidatePayload, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/validateDomain", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.validate_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainValidateResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod bindings { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + binding_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + binding_name: binding_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + binding_name: impl Into, + binding_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + binding_name: binding_name.into(), + binding_resource: binding_resource.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + binding_name: impl Into, + binding_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + binding_name: binding_name.into(), + binding_resource: binding_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + binding_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + binding_name: binding_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) binding_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/bindings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.binding_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BindingResource), + Created201(models::BindingResource), + Accepted202(models::BindingResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) binding_name: String, + pub(crate) binding_resource: models::BindingResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/bindings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.binding_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.binding_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BindingResource), + Accepted202(models::BindingResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) binding_name: String, + pub(crate) binding_resource: models::BindingResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/bindings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.binding_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.binding_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BindingResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) binding_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/bindings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.binding_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/bindings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BindingResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod storages { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + storage_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + storage_name: storage_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + storage_name: impl Into, + storage_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + storage_name: storage_name.into(), + storage_resource: storage_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + storage_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + storage_name: storage_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) storage_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/storages/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.storage_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::StorageResource), + Created201(models::StorageResource), + Accepted202(models::StorageResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) storage_name: String, + pub(crate) storage_resource: models::StorageResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/storages/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.storage_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.storage_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) storage_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/storages/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.storage_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/storages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod certificates { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + certificate_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_name: certificate_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + certificate_name: impl Into, + certificate_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_name: certificate_name.into(), + certificate_resource: certificate_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + certificate_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_name: certificate_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CertificateResource), + Created201(models::CertificateResource), + Accepted202(models::CertificateResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_name: String, + pub(crate) certificate_resource: models::CertificateResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.certificate_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/certificates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod custom_domains { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + domain_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + domain_name: domain_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + domain_name: impl Into, + domain_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + domain_name: domain_name.into(), + domain_resource: domain_resource.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + domain_name: impl Into, + domain_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + domain_name: domain_name.into(), + domain_resource: domain_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + domain_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + domain_name: domain_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) domain_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CustomDomainResource), + Created201(models::CustomDomainResource), + Accepted202(models::CustomDomainResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) domain_name: String, + pub(crate) domain_resource: models::CustomDomainResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.domain_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CustomDomainResource), + Accepted202(models::CustomDomainResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) domain_name: String, + pub(crate) domain_resource: models::CustomDomainResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.domain_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) domain_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/domains", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod deployments { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + deployment_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + deployment_resource: deployment_resource.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + deployment_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + deployment_resource: deployment_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + version: Vec::new(), + } + } + pub fn list_for_cluster( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_for_cluster::Builder { + list_for_cluster::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version: Vec::new(), + } + } + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + } + } + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + } + } + pub fn restart( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + } + } + pub fn get_log_file_url( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + ) -> get_log_file_url::Builder { + get_log_file_url::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + } + } + pub fn generate_heap_dump( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + diagnostic_parameters: impl Into, + ) -> generate_heap_dump::Builder { + generate_heap_dump::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + diagnostic_parameters: diagnostic_parameters.into(), + } + } + pub fn generate_thread_dump( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + diagnostic_parameters: impl Into, + ) -> generate_thread_dump::Builder { + generate_thread_dump::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + diagnostic_parameters: diagnostic_parameters.into(), + } + } + pub fn start_jfr( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + app_name: impl Into, + deployment_name: impl Into, + diagnostic_parameters: impl Into, + ) -> start_jfr::Builder { + start_jfr::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + app_name: app_name.into(), + deployment_name: deployment_name.into(), + diagnostic_parameters: diagnostic_parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.deployment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DeploymentResource), + Created201(models::DeploymentResource), + Accepted202(models::DeploymentResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + pub(crate) deployment_resource: models::DeploymentResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.deployment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.deployment_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DeploymentResource), + Accepted202(models::DeploymentResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + pub(crate) deployment_resource: models::DeploymentResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.deployment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.deployment_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.deployment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) version: Vec, + } + impl Builder { + pub fn version(mut self, version: Vec) -> Self { + self.version = version; + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let version = &self.version; + for value in &self.version { + url.query_pairs_mut().append_pair("version", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_for_cluster { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) version: Vec, + } + impl Builder { + pub fn version(mut self, version: Vec) -> Self { + self.version = version; + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/deployments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let version = &self.version; + for value in &self.version { + url.query_pairs_mut().append_pair("version", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.deployment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.deployment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod restart { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}/restart", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.deployment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_log_file_url { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::LogFileUrlResponse), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}/getLogFileUrl" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . app_name , & self . deployment_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogFileUrlResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_heap_dump { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + pub(crate) diagnostic_parameters: models::DiagnosticParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}/generateHeapDump" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . app_name , & self . deployment_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.diagnostic_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_thread_dump { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + pub(crate) diagnostic_parameters: models::DiagnosticParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}/generateThreadDump" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . app_name , & self . deployment_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.diagnostic_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start_jfr { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) app_name: String, + pub(crate) deployment_name: String, + pub(crate) diagnostic_parameters: models::DiagnosticParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apps/{}/deployments/{}/startJFR", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.app_name, + &self.deployment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.diagnostic_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.AppPlatform/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableOperations = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod runtime_versions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_runtime_versions(&self) -> list_runtime_versions::Builder { + list_runtime_versions::Builder { client: self.0.clone() } + } + } + pub mod list_runtime_versions { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.AppPlatform/runtimeVersions", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableRuntimeVersions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod skus { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.AppPlatform/skus", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceSkuCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gateways { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + gateway_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + gateway_resource: gateway_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn validate_domain( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + validate_payload: impl Into, + ) -> validate_domain::Builder { + validate_domain::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + validate_payload: validate_payload.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::GatewayResource), + Created201(models::GatewayResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + pub(crate) gateway_resource: models::GatewayResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gateway_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_domain { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + pub(crate) validate_payload: models::CustomDomainValidatePayload, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/validateDomain", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.validate_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainValidateResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gateway_route_configs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + route_config_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + route_config_name: route_config_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + route_config_name: impl Into, + gateway_route_config_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + route_config_name: route_config_name.into(), + gateway_route_config_resource: gateway_route_config_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + route_config_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + route_config_name: route_config_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + pub(crate) route_config_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/routeConfigs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name, + &self.route_config_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayRouteConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::GatewayRouteConfigResource), + Created201(models::GatewayRouteConfigResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + pub(crate) route_config_name: String, + pub(crate) gateway_route_config_resource: models::GatewayRouteConfigResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/routeConfigs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name, + &self.route_config_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gateway_route_config_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayRouteConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayRouteConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + pub(crate) route_config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/routeConfigs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name, + &self.route_config_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/routeConfigs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayRouteConfigResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gateway_custom_domains { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + domain_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + domain_name: domain_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + domain_name: impl Into, + gateway_custom_domain_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + domain_name: domain_name.into(), + gateway_custom_domain_resource: gateway_custom_domain_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + domain_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + domain_name: domain_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + gateway_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_name: gateway_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + pub(crate) domain_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::GatewayCustomDomainResource), + Created201(models::GatewayCustomDomainResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + pub(crate) domain_name: String, + pub(crate) gateway_custom_domain_resource: models::GatewayCustomDomainResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gateway_custom_domain_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + pub(crate) domain_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/gateways/{}/domains", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCustomDomainResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_portals { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + api_portal_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_portal_name: api_portal_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + api_portal_name: impl Into, + api_portal_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_portal_name: api_portal_name.into(), + api_portal_resource: api_portal_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + api_portal_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_portal_name: api_portal_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn validate_domain( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + api_portal_name: impl Into, + validate_payload: impl Into, + ) -> validate_domain::Builder { + validate_domain::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_portal_name: api_portal_name.into(), + validate_payload: validate_payload.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_portal_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_portal_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiPortalResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiPortalResource), + Created201(models::ApiPortalResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_portal_name: String, + pub(crate) api_portal_resource: models::ApiPortalResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_portal_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.api_portal_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiPortalResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiPortalResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_portal_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_portal_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiPortalResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_domain { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_portal_name: String, + pub(crate) validate_payload: models::CustomDomainValidatePayload, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals/{}/validateDomain", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_portal_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.validate_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainValidateResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_portal_custom_domains { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + api_portal_name: impl Into, + domain_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_portal_name: api_portal_name.into(), + domain_name: domain_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + api_portal_name: impl Into, + domain_name: impl Into, + api_portal_custom_domain_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_portal_name: api_portal_name.into(), + domain_name: domain_name.into(), + api_portal_custom_domain_resource: api_portal_custom_domain_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + api_portal_name: impl Into, + domain_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_portal_name: api_portal_name.into(), + domain_name: domain_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + api_portal_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_portal_name: api_portal_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_portal_name: String, + pub(crate) domain_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_portal_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiPortalCustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiPortalCustomDomainResource), + Created201(models::ApiPortalCustomDomainResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_portal_name: String, + pub(crate) domain_name: String, + pub(crate) api_portal_custom_domain_resource: models::ApiPortalCustomDomainResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_portal_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.api_portal_custom_domain_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiPortalCustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiPortalCustomDomainResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_portal_name: String, + pub(crate) domain_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals/{}/domains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_portal_name, + &self.domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_portal_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}/apiPortals/{}/domains", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_portal_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiPortalCustomDomainResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/arcdata/src/package_2021_11_01/models.rs b/services/mgmt/arcdata/src/package_2021_11_01/models.rs index 4a3427ab38..6e48c9d5da 100644 --- a/services/mgmt/arcdata/src/package_2021_11_01/models.rs +++ b/services/mgmt/arcdata/src/package_2021_11_01/models.rs @@ -241,6 +241,7 @@ pub mod sql_managed_instance_properties { pub enum LicenseType { BasePrice, LicenseIncluded, + DisasterRecovery, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] diff --git a/services/mgmt/billing/src/package_2021_10/models.rs b/services/mgmt/billing/src/package_2021_10/models.rs index ac3698ec86..6660d4f76d 100644 --- a/services/mgmt/billing/src/package_2021_10/models.rs +++ b/services/mgmt/billing/src/package_2021_10/models.rs @@ -3,6 +3,164 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Amount { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub currency: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingSubscription { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingSubscriptionAlias { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingSubscriptionAliasListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingSubscriptionAliasProperties { + #[serde(flatten)] + pub billing_subscription_properties: BillingSubscriptionProperties, + #[serde(rename = "billingSubscriptionId", default, skip_serializing_if = "Option::is_none")] + pub billing_subscription_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingSubscriptionMergeRequest { + #[serde(rename = "targetBillingSubscriptionName", default, skip_serializing_if = "Option::is_none")] + pub target_billing_subscription_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingSubscriptionProperties { + #[serde(rename = "autoRenew", default, skip_serializing_if = "Option::is_none")] + pub auto_renew: Option, + #[serde(rename = "beneficiaryTenantId", default, skip_serializing_if = "Option::is_none")] + pub beneficiary_tenant_id: Option, + #[serde(rename = "billingFrequency", default, skip_serializing_if = "Option::is_none")] + pub billing_frequency: Option, + #[serde(rename = "billingProfileId", default, skip_serializing_if = "Option::is_none")] + pub billing_profile_id: Option, + #[serde(rename = "billingPolicies", default, skip_serializing_if = "Option::is_none")] + pub billing_policies: Option, + #[serde(rename = "billingProfileDisplayName", default, skip_serializing_if = "Option::is_none")] + pub billing_profile_display_name: Option, + #[serde(rename = "billingProfileName", default, skip_serializing_if = "Option::is_none")] + pub billing_profile_name: Option, + #[serde(rename = "consumptionCostCenter", default, skip_serializing_if = "Option::is_none")] + pub consumption_cost_center: Option, + #[serde(rename = "customerId", default, skip_serializing_if = "Option::is_none")] + pub customer_id: Option, + #[serde(rename = "customerDisplayName", default, skip_serializing_if = "Option::is_none")] + pub customer_display_name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "enrollmentAccountId", default, skip_serializing_if = "Option::is_none")] + pub enrollment_account_id: Option, + #[serde(rename = "enrollmentAccountDisplayName", default, skip_serializing_if = "Option::is_none")] + pub enrollment_account_display_name: Option, + #[serde(rename = "enrollmentAccountSubscriptionDetails", default, skip_serializing_if = "Option::is_none")] + pub enrollment_account_subscription_details: Option, + #[serde(rename = "invoiceSectionId", default, skip_serializing_if = "Option::is_none")] + pub invoice_section_id: Option, + #[serde(rename = "invoiceSectionDisplayName", default, skip_serializing_if = "Option::is_none")] + pub invoice_section_display_name: Option, + #[serde(rename = "invoiceSectionName", default, skip_serializing_if = "Option::is_none")] + pub invoice_section_name: Option, + #[serde(rename = "lastMonthCharges", default, skip_serializing_if = "Option::is_none")] + pub last_month_charges: Option, + #[serde(rename = "monthToDateCharges", default, skip_serializing_if = "Option::is_none")] + pub month_to_date_charges: Option, + #[serde(rename = "nextBillingCycleDetails", default, skip_serializing_if = "Option::is_none")] + pub next_billing_cycle_details: Option, + #[serde(rename = "offerId", default, skip_serializing_if = "Option::is_none")] + pub offer_id: Option, + #[serde(rename = "productCategory", default, skip_serializing_if = "Option::is_none")] + pub product_category: Option, + #[serde(rename = "productType", default, skip_serializing_if = "Option::is_none")] + pub product_type: Option, + #[serde(rename = "productTypeId", default, skip_serializing_if = "Option::is_none")] + pub product_type_id: Option, + #[serde(rename = "purchaseDate", default, skip_serializing_if = "Option::is_none")] + pub purchase_date: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reseller: Option, + #[serde(rename = "renewalTermDetails", default, skip_serializing_if = "Option::is_none")] + pub renewal_term_details: Option, + #[serde(rename = "skuDescription", default, skip_serializing_if = "Option::is_none")] + pub sku_description: Option, + #[serde(rename = "skuId", default, skip_serializing_if = "Option::is_none")] + pub sku_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(rename = "suspensionReasons", default, skip_serializing_if = "Vec::is_empty")] + pub suspension_reasons: Vec, + #[serde(rename = "termDuration", default, skip_serializing_if = "Option::is_none")] + pub term_duration: Option, + #[serde(rename = "termStartDate", default, skip_serializing_if = "Option::is_none")] + pub term_start_date: Option, + #[serde(rename = "termEndDate", default, skip_serializing_if = "Option::is_none")] + pub term_end_date: Option, +} +pub mod billing_subscription_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoRenew { + Off, + On, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Unknown, + Active, + Disabled, + Deleted, + Warned, + Expiring, + Expired, + AutoRenew, + Cancelled, + Suspended, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingSubscriptionSplitRequest { + #[serde(rename = "billingFrequency", default, skip_serializing_if = "Option::is_none")] + pub billing_frequency: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantity: Option, + #[serde(rename = "targetProductTypeId", default, skip_serializing_if = "Option::is_none")] + pub target_product_type_id: Option, + #[serde(rename = "targetSkuId", default, skip_serializing_if = "Option::is_none")] + pub target_sku_id: Option, + #[serde(rename = "termDuration", default, skip_serializing_if = "Option::is_none")] + pub term_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingSubscriptionsListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DetachPaymentMethodEligibilityError { #[serde(default, skip_serializing_if = "Option::is_none")] pub code: Option, @@ -32,6 +190,25 @@ pub struct DetachPaymentMethodErrorDetails { pub message: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnrollmentAccountSubscriptionDetails { + #[serde(rename = "subscriptionEnrollmentAccountStatus", default, skip_serializing_if = "Option::is_none")] + pub subscription_enrollment_account_status: Option, + #[serde(rename = "enrollmentAccountStartDate", default, skip_serializing_if = "Option::is_none")] + pub enrollment_account_start_date: Option, +} +pub mod enrollment_account_subscription_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SubscriptionEnrollmentAccountStatus { + Active, + Cancelled, + Expired, + Deleted, + TransferredOut, + Transferring, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorDetails { #[serde(default, skip_serializing_if = "Option::is_none")] pub code: Option, @@ -49,6 +226,45 @@ pub struct ErrorResponse { } pub type ErrorSubDetails = Vec; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum MoveBillingSubscriptionEligibilityErrorCode { + AccountIsLocked, + AssetNotActive, + AssetHasCap, + BillingAccountInactive, + BillingProfilePastDue, + CrossBillingAccountNotAllowed, + DestinationBillingProfileNotFound, + DestinationBillingProfileInactive, + DestinationBillingProfilePastDue, + DestinationInvoiceSectionNotFound, + DestinationInvoiceSectionInactive, + InvalidDestination, + InvalidSource, + InvoiceSectionIsRestricted, + InsufficientPermissionOnDestination, + InsufficientPermissionOnSource, + MarketplaceNotEnabledOnDestination, + ProductNotFound, + ProductInactive, + ProductTypeNotSupported, + SourceBillingProfilePastDue, + SourceInvoiceSectionInactive, + SubscriptionNotActive, + SubscriptionTypeNotSupported, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveBillingSubscriptionRequest { + #[serde(rename = "destinationEnrollmentAccountId", default, skip_serializing_if = "Option::is_none")] + pub destination_enrollment_account_id: Option, + #[serde(rename = "destinationInvoiceSectionId", default, skip_serializing_if = "Option::is_none")] + pub destination_invoice_section_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NextBillingCycleDetails { + #[serde(rename = "billingFrequency", default, skip_serializing_if = "Option::is_none")] + pub billing_frequency: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Operation { #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, @@ -194,6 +410,26 @@ pub struct PaymentMethodsListResult { pub next_link: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RenewalTermDetails { + #[serde(rename = "billingFrequency", default, skip_serializing_if = "Option::is_none")] + pub billing_frequency: Option, + #[serde(rename = "productTypeId", default, skip_serializing_if = "Option::is_none")] + pub product_type_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantity: Option, + #[serde(rename = "skuId", default, skip_serializing_if = "Option::is_none")] + pub sku_id: Option, + #[serde(rename = "termDuration", default, skip_serializing_if = "Option::is_none")] + pub term_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Reseller { + #[serde(rename = "resellerId", default, skip_serializing_if = "Option::is_none")] + pub reseller_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Resource { #[serde(default, skip_serializing_if = "Option::is_none")] pub id: Option, @@ -202,3 +438,19 @@ pub struct Resource { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, } +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateMoveBillingSubscriptionEligibilityError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateMoveBillingSubscriptionEligibilityResult { + #[serde(rename = "isMoveEligible", default, skip_serializing_if = "Option::is_none")] + pub is_move_eligible: Option, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Option::is_none")] + pub error_details: Option, +} diff --git a/services/mgmt/billing/src/package_2021_10/operations.rs b/services/mgmt/billing/src/package_2021_10/operations.rs index 743f2c5f2b..45ce0e959a 100644 --- a/services/mgmt/billing/src/package_2021_10/operations.rs +++ b/services/mgmt/billing/src/package_2021_10/operations.rs @@ -74,66 +74,1135 @@ impl Client { pipeline, } } + pub fn billing_subscriptions(&self) -> billing_subscriptions::Client { + billing_subscriptions::Client(self.clone()) + } + pub fn billing_subscriptions_aliases(&self) -> billing_subscriptions_aliases::Client { + billing_subscriptions_aliases::Client(self.clone()) + } pub fn operations(&self) -> operations::Client { operations::Client(self.clone()) } - pub fn payment_method_at_billing_account(&self) -> payment_method_at_billing_account::Client { - payment_method_at_billing_account::Client(self.clone()) + pub fn payment_methods(&self) -> payment_methods::Client { + payment_methods::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + BillingSubscriptions_ListByBillingAccount(#[from] billing_subscriptions::list_by_billing_account::Error), + #[error(transparent)] + BillingSubscriptions_Get(#[from] billing_subscriptions::get::Error), + #[error(transparent)] + BillingSubscriptions_Update(#[from] billing_subscriptions::update::Error), + #[error(transparent)] + BillingSubscriptions_Delete(#[from] billing_subscriptions::delete::Error), + #[error(transparent)] + BillingSubscriptions_Move(#[from] billing_subscriptions::move_::Error), + #[error(transparent)] + BillingSubscriptions_ValidateMoveEligibility(#[from] billing_subscriptions::validate_move_eligibility::Error), + #[error(transparent)] + BillingSubscriptions_Merge(#[from] billing_subscriptions::merge::Error), + #[error(transparent)] + BillingSubscriptions_Split(#[from] billing_subscriptions::split::Error), + #[error(transparent)] + BillingSubscriptionsAliases_ListByBillingAccount(#[from] billing_subscriptions_aliases::list_by_billing_account::Error), + #[error(transparent)] + BillingSubscriptionsAliases_Get(#[from] billing_subscriptions_aliases::get::Error), + #[error(transparent)] + BillingSubscriptionsAliases_CreateOrUpdate(#[from] billing_subscriptions_aliases::create_or_update::Error), + #[error(transparent)] + PaymentMethods_ListByUser(#[from] payment_methods::list_by_user::Error), + #[error(transparent)] + PaymentMethods_GetByUser(#[from] payment_methods::get_by_user::Error), + #[error(transparent)] + PaymentMethods_DeleteByUser(#[from] payment_methods::delete_by_user::Error), + #[error(transparent)] + PaymentMethods_ListByBillingAccount(#[from] payment_methods::list_by_billing_account::Error), + #[error(transparent)] + PaymentMethods_GetByBillingAccount(#[from] payment_methods::get_by_billing_account::Error), + #[error(transparent)] + PaymentMethods_ListByBillingProfile(#[from] payment_methods::list_by_billing_profile::Error), + #[error(transparent)] + PaymentMethods_GetByBillingProfile(#[from] payment_methods::get_by_billing_profile::Error), + #[error(transparent)] + PaymentMethods_DeleteAtBillingProfile(#[from] payment_methods::delete_at_billing_profile::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), +} +pub mod billing_subscriptions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_billing_account(&self, billing_account_name: impl Into) -> list_by_billing_account::Builder { + list_by_billing_account::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + } + } + pub fn get(&self, billing_account_name: impl Into, billing_subscription_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_subscription_name: billing_subscription_name.into(), + } + } + pub fn update( + &self, + billing_account_name: impl Into, + billing_subscription_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_subscription_name: billing_subscription_name.into(), + parameters: parameters.into(), + } + } + pub fn delete(&self, billing_account_name: impl Into, billing_subscription_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_subscription_name: billing_subscription_name.into(), + } + } + pub fn move_( + &self, + billing_account_name: impl Into, + billing_subscription_name: impl Into, + parameters: impl Into, + ) -> move_::Builder { + move_::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_subscription_name: billing_subscription_name.into(), + parameters: parameters.into(), + } + } + pub fn validate_move_eligibility( + &self, + billing_account_name: impl Into, + billing_subscription_name: impl Into, + parameters: impl Into, + ) -> validate_move_eligibility::Builder { + validate_move_eligibility::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_subscription_name: billing_subscription_name.into(), + parameters: parameters.into(), + } + } + pub fn merge( + &self, + billing_account_name: impl Into, + billing_subscription_name: impl Into, + parameters: impl Into, + ) -> merge::Builder { + merge::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_subscription_name: billing_subscription_name.into(), + parameters: parameters.into(), + } + } + pub fn split( + &self, + billing_account_name: impl Into, + billing_subscription_name: impl Into, + parameters: impl Into, + ) -> split::Builder { + split::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_subscription_name: billing_subscription_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list_by_billing_account { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptions", + self.client.endpoint(), + &self.billing_account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscriptionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } } - pub fn payment_method_at_billing_profile(&self) -> payment_method_at_billing_profile::Client { - payment_method_at_billing_profile::Client(self.clone()) + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_subscription_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptions/{}", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_subscription_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } } - pub fn payment_method_owned_by_user(&self) -> payment_method_owned_by_user::Client { - payment_method_owned_by_user::Client(self.clone()) + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BillingSubscription), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_subscription_name: String, + pub(crate) parameters: models::BillingSubscription, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptions/{}", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_subscription_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_subscription_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptions/{}", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_subscription_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod move_ { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BillingSubscription), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_subscription_name: String, + pub(crate) parameters: models::MoveBillingSubscriptionRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptions/{}/move", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_subscription_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_move_eligibility { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_subscription_name: String, + pub(crate) parameters: models::MoveBillingSubscriptionRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptions/{}/validateMoveEligibility", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_subscription_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateMoveBillingSubscriptionEligibilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod merge { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BillingSubscription), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_subscription_name: String, + pub(crate) parameters: models::BillingSubscriptionMergeRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptions/{}/merge", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_subscription_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod split { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BillingSubscription), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_subscription_name: String, + pub(crate) parameters: models::BillingSubscriptionSplitRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptions/{}/split", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_subscription_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod billing_subscriptions_aliases { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_billing_account(&self, billing_account_name: impl Into) -> list_by_billing_account::Builder { + list_by_billing_account::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + } + } + pub fn get(&self, billing_account_name: impl Into, alias_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + alias_name: alias_name.into(), + } + } + pub fn create_or_update( + &self, + billing_account_name: impl Into, + alias_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + alias_name: alias_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list_by_billing_account { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptionAliases", + self.client.endpoint(), + &self.billing_account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscriptionAliasListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) alias_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptionAliases/{}", + self.client.endpoint(), + &self.billing_account_name, + &self.alias_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscriptionAlias = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } } - pub fn payment_methods(&self) -> payment_methods::Client { - payment_methods::Client(self.clone()) + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BillingSubscriptionAlias), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) alias_name: String, + pub(crate) parameters: models::BillingSubscriptionAlias, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingSubscriptionAliases/{}", + self.client.endpoint(), + &self.billing_account_name, + &self.alias_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BillingSubscriptionAlias = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } } } -#[non_exhaustive] -#[derive(Debug, thiserror :: Error)] -#[allow(non_camel_case_types)] -pub enum Error { - #[error(transparent)] - PaymentMethodOwnedByUser_List(#[from] payment_method_owned_by_user::list::Error), - #[error(transparent)] - PaymentMethodOwnedByUser_Get(#[from] payment_method_owned_by_user::get::Error), - #[error(transparent)] - PaymentMethodOwnedByUser_Delete(#[from] payment_method_owned_by_user::delete::Error), - #[error(transparent)] - PaymentMethods_ListByBillingAccount(#[from] payment_methods::list_by_billing_account::Error), - #[error(transparent)] - PaymentMethodAtBillingAccount_Get(#[from] payment_method_at_billing_account::get::Error), - #[error(transparent)] - PaymentMethods_ListByBillingProfile(#[from] payment_methods::list_by_billing_profile::Error), - #[error(transparent)] - PaymentMethods_GetByBillingProfile(#[from] payment_methods::get_by_billing_profile::Error), - #[error(transparent)] - PaymentMethodAtBillingProfile_Remove(#[from] payment_method_at_billing_profile::remove::Error), - #[error(transparent)] - Operations_List(#[from] operations::list::Error), -} -pub mod payment_method_owned_by_user { +pub mod payment_methods { use super::{models, API_VERSION}; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } + pub fn list_by_user(&self) -> list_by_user::Builder { + list_by_user::Builder { client: self.0.clone() } } - pub fn get(&self, payment_method_name: impl Into) -> get::Builder { - get::Builder { + pub fn get_by_user(&self, payment_method_name: impl Into) -> get_by_user::Builder { + get_by_user::Builder { client: self.0.clone(), payment_method_name: payment_method_name.into(), } } - pub fn delete(&self, payment_method_name: impl Into) -> delete::Builder { - delete::Builder { + pub fn delete_by_user(&self, payment_method_name: impl Into) -> delete_by_user::Builder { + delete_by_user::Builder { + client: self.0.clone(), + payment_method_name: payment_method_name.into(), + } + } + pub fn list_by_billing_account(&self, billing_account_name: impl Into) -> list_by_billing_account::Builder { + list_by_billing_account::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + } + } + pub fn get_by_billing_account( + &self, + billing_account_name: impl Into, + payment_method_name: impl Into, + ) -> get_by_billing_account::Builder { + get_by_billing_account::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + payment_method_name: payment_method_name.into(), + } + } + pub fn list_by_billing_profile( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + ) -> list_by_billing_profile::Builder { + list_by_billing_profile::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + } + } + pub fn get_by_billing_profile( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + payment_method_name: impl Into, + ) -> get_by_billing_profile::Builder { + get_by_billing_profile::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + payment_method_name: payment_method_name.into(), + } + } + pub fn delete_at_billing_profile( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + payment_method_name: impl Into, + ) -> delete_at_billing_profile::Builder { + delete_at_billing_profile::Builder { client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), payment_method_name: payment_method_name.into(), } } } - pub mod list { + pub mod list_by_user { use super::{models, API_VERSION}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -201,7 +1270,7 @@ pub mod payment_method_owned_by_user { } } } - pub mod get { + pub mod get_by_user { use super::{models, API_VERSION}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -274,7 +1343,7 @@ pub mod payment_method_owned_by_user { } } } - pub mod delete { + pub mod delete_by_user { use super::{models, API_VERSION}; #[derive(Debug)] pub enum Response { @@ -348,42 +1417,6 @@ pub mod payment_method_owned_by_user { } } } -} -pub mod payment_methods { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_billing_account(&self, billing_account_name: impl Into) -> list_by_billing_account::Builder { - list_by_billing_account::Builder { - client: self.0.clone(), - billing_account_name: billing_account_name.into(), - } - } - pub fn list_by_billing_profile( - &self, - billing_account_name: impl Into, - billing_profile_name: impl Into, - ) -> list_by_billing_profile::Builder { - list_by_billing_profile::Builder { - client: self.0.clone(), - billing_account_name: billing_account_name.into(), - billing_profile_name: billing_profile_name.into(), - } - } - pub fn get_by_billing_profile( - &self, - billing_account_name: impl Into, - billing_profile_name: impl Into, - payment_method_name: impl Into, - ) -> get_by_billing_profile::Builder { - get_by_billing_profile::Builder { - client: self.0.clone(), - billing_account_name: billing_account_name.into(), - billing_profile_name: billing_profile_name.into(), - payment_method_name: payment_method_name.into(), - } - } - } pub mod list_by_billing_account { use super::{models, API_VERSION}; #[derive(Debug, thiserror :: Error)] @@ -457,7 +1490,7 @@ pub mod payment_methods { } } } - pub mod list_by_billing_profile { + pub mod get_by_billing_account { use super::{models, API_VERSION}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -485,18 +1518,16 @@ pub mod payment_methods { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) billing_account_name: String, - pub(crate) billing_profile_name: String, + pub(crate) payment_method_name: String, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/paymentMethodLinks", + "{}/providers/Microsoft.Billing/billingAccounts/{}/paymentMethods/{}", self.client.endpoint(), &self.billing_account_name, - &self.billing_profile_name + &self.payment_method_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -516,7 +1547,7 @@ pub mod payment_methods { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PaymentMethodLinksListResult = + let rsp_value: models::PaymentMethod = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -534,7 +1565,7 @@ pub mod payment_methods { } } } - pub mod get_by_billing_profile { + pub mod list_by_billing_profile { use super::{models, API_VERSION}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -563,17 +1594,17 @@ pub mod payment_methods { pub(crate) client: super::super::Client, pub(crate) billing_account_name: String, pub(crate) billing_profile_name: String, - pub(crate) payment_method_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/paymentMethodLinks/{}", + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/paymentMethodLinks", self.client.endpoint(), &self.billing_account_name, - &self.billing_profile_name, - &self.payment_method_name + &self.billing_profile_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -593,7 +1624,7 @@ pub mod payment_methods { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PaymentMethodLink = + let rsp_value: models::PaymentMethodLinksListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -611,20 +1642,7 @@ pub mod payment_methods { } } } -} -pub mod payment_method_at_billing_account { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get(&self, billing_account_name: impl Into, payment_method_name: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - billing_account_name: billing_account_name.into(), - payment_method_name: payment_method_name.into(), - } - } - } - pub mod get { + pub mod get_by_billing_profile { use super::{models, API_VERSION}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -652,15 +1670,17 @@ pub mod payment_method_at_billing_account { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, pub(crate) payment_method_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/providers/Microsoft.Billing/billingAccounts/{}/paymentMethods/{}", + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/paymentMethodLinks/{}", self.client.endpoint(), &self.billing_account_name, + &self.billing_profile_name, &self.payment_method_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; @@ -681,7 +1701,7 @@ pub mod payment_method_at_billing_account { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PaymentMethod = + let rsp_value: models::PaymentMethodLink = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -699,26 +1719,7 @@ pub mod payment_method_at_billing_account { } } } -} -pub mod payment_method_at_billing_profile { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn remove( - &self, - billing_account_name: impl Into, - billing_profile_name: impl Into, - payment_method_name: impl Into, - ) -> remove::Builder { - remove::Builder { - client: self.0.clone(), - billing_account_name: billing_account_name.into(), - billing_profile_name: billing_profile_name.into(), - payment_method_name: payment_method_name.into(), - } - } - } - pub mod remove { + pub mod delete_at_billing_profile { use super::{models, API_VERSION}; #[derive(Debug)] pub enum Response { diff --git a/services/mgmt/botservice/src/package_2021_03_01/models.rs b/services/mgmt/botservice/src/package_2021_03_01/models.rs index afbd437899..8d0a6fe17d 100644 --- a/services/mgmt/botservice/src/package_2021_03_01/models.rs +++ b/services/mgmt/botservice/src/package_2021_03_01/models.rs @@ -8,10 +8,6 @@ pub struct AlexaChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AlexaChannelProperties { @@ -83,8 +79,8 @@ pub struct BotProperties { pub cmek_key_vault_url: Option, #[serde(rename = "cmekEncryptionStatus", default, skip_serializing_if = "Option::is_none")] pub cmek_encryption_status: Option, - #[serde(rename = "isIsolated", default, skip_serializing_if = "Option::is_none")] - pub is_isolated: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, #[serde(rename = "isStreamingSupported", default, skip_serializing_if = "Option::is_none")] pub is_streaming_supported: Option, #[serde(rename = "isDeveloperAppInsightsApiKeySet", default, skip_serializing_if = "Option::is_none")] @@ -95,6 +91,8 @@ pub struct BotProperties { pub disable_local_auth: Option, #[serde(rename = "schemaTransformationVersion", default, skip_serializing_if = "Option::is_none")] pub schema_transformation_version: Option, + #[serde(rename = "storageResourceId", default, skip_serializing_if = "Option::is_none")] + pub storage_resource_id: Option, #[serde(rename = "openWithHint", default, skip_serializing_if = "Option::is_none")] pub open_with_hint: Option, #[serde(rename = "appPasswordHint", default, skip_serializing_if = "Option::is_none")] @@ -113,6 +111,11 @@ pub mod bot_properties { SingleTenant, MultiTenant, } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BotResponseList { @@ -127,6 +130,10 @@ pub struct Channel { pub channel_name: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub etag: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ChannelResponseList { @@ -136,6 +143,27 @@ pub struct ChannelResponseList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ChannelSettings { + #[serde(rename = "extensionKey1", default, skip_serializing_if = "Option::is_none")] + pub extension_key1: Option, + #[serde(rename = "extensionKey2", default, skip_serializing_if = "Option::is_none")] + pub extension_key2: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sites: Vec, + #[serde(rename = "channelId", default, skip_serializing_if = "Option::is_none")] + pub channel_id: Option, + #[serde(rename = "channelDisplayName", default, skip_serializing_if = "Option::is_none")] + pub channel_display_name: Option, + #[serde(rename = "botId", default, skip_serializing_if = "Option::is_none")] + pub bot_id: Option, + #[serde(rename = "botIconUrl", default, skip_serializing_if = "Option::is_none")] + pub bot_icon_url: Option, + #[serde(rename = "isEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_enabled: Option, + #[serde(rename = "disableLocalAuth", default, skip_serializing_if = "Option::is_none")] + pub disable_local_auth: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CheckNameAvailabilityRequestBody { #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, @@ -170,6 +198,10 @@ pub struct ConnectionSettingParameter { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ConnectionSettingProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] pub client_id: Option, #[serde(rename = "settingId", default, skip_serializing_if = "Option::is_none")] @@ -200,12 +232,6 @@ pub struct DirectLineChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DirectLineChannelProperties { @@ -389,17 +415,20 @@ pub struct LineRegistration { pub channel_access_token: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListChannelWithKeysResponse { + #[serde(flatten)] + pub bot_channel: BotChannel, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub setting: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MsTeamsChannel { #[serde(flatten)] pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MsTeamsChannelProperties { @@ -527,6 +556,17 @@ pub struct ServiceProviderResponseList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Site { + #[serde(flatten)] + pub web_chat_site: WebChatSite, + #[serde(flatten)] + pub direct_line_site: DirectLineSite, + #[serde(rename = "isTokenEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_token_enabled: Option, + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct SiteInfo { #[serde(rename = "siteName")] pub site_name: String, @@ -567,8 +607,6 @@ pub struct SkypeChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct SkypeChannelProperties { @@ -664,12 +702,6 @@ pub struct WebChatChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WebChatChannelProperties { diff --git a/services/mgmt/botservice/src/package_2021_03_01/operations.rs b/services/mgmt/botservice/src/package_2021_03_01/operations.rs index 461242d482..328b41121d 100644 --- a/services/mgmt/botservice/src/package_2021_03_01/operations.rs +++ b/services/mgmt/botservice/src/package_2021_03_01/operations.rs @@ -1260,7 +1260,9 @@ pub mod channels { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.BotService/botServices/{}/channels/{}/listChannelWithKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . channel_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; @@ -1282,7 +1284,7 @@ pub mod channels { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BotChannel = + let rsp_value: models::ListChannelWithKeysResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/botservice/src/package_preview_2021_05/models.rs b/services/mgmt/botservice/src/package_preview_2021_05/models.rs index 4c31aa158a..967e6c56df 100644 --- a/services/mgmt/botservice/src/package_preview_2021_05/models.rs +++ b/services/mgmt/botservice/src/package_preview_2021_05/models.rs @@ -8,10 +8,6 @@ pub struct AlexaChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AlexaChannelProperties { @@ -83,8 +79,8 @@ pub struct BotProperties { pub cmek_key_vault_url: Option, #[serde(rename = "cmekEncryptionStatus", default, skip_serializing_if = "Option::is_none")] pub cmek_encryption_status: Option, - #[serde(rename = "isIsolated", default, skip_serializing_if = "Option::is_none")] - pub is_isolated: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, #[serde(rename = "isStreamingSupported", default, skip_serializing_if = "Option::is_none")] pub is_streaming_supported: Option, #[serde(rename = "isDeveloperAppInsightsApiKeySet", default, skip_serializing_if = "Option::is_none")] @@ -95,6 +91,8 @@ pub struct BotProperties { pub disable_local_auth: Option, #[serde(rename = "schemaTransformationVersion", default, skip_serializing_if = "Option::is_none")] pub schema_transformation_version: Option, + #[serde(rename = "storageResourceId", default, skip_serializing_if = "Option::is_none")] + pub storage_resource_id: Option, #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] pub private_endpoint_connections: Vec, #[serde(rename = "openWithHint", default, skip_serializing_if = "Option::is_none")] @@ -115,6 +113,11 @@ pub mod bot_properties { SingleTenant, MultiTenant, } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BotResponseList { @@ -129,6 +132,10 @@ pub struct Channel { pub channel_name: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub etag: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ChannelResponseList { @@ -138,6 +145,27 @@ pub struct ChannelResponseList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ChannelSettings { + #[serde(rename = "extensionKey1", default, skip_serializing_if = "Option::is_none")] + pub extension_key1: Option, + #[serde(rename = "extensionKey2", default, skip_serializing_if = "Option::is_none")] + pub extension_key2: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sites: Vec, + #[serde(rename = "channelId", default, skip_serializing_if = "Option::is_none")] + pub channel_id: Option, + #[serde(rename = "channelDisplayName", default, skip_serializing_if = "Option::is_none")] + pub channel_display_name: Option, + #[serde(rename = "botId", default, skip_serializing_if = "Option::is_none")] + pub bot_id: Option, + #[serde(rename = "botIconUrl", default, skip_serializing_if = "Option::is_none")] + pub bot_icon_url: Option, + #[serde(rename = "isEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_enabled: Option, + #[serde(rename = "disableLocalAuth", default, skip_serializing_if = "Option::is_none")] + pub disable_local_auth: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CheckNameAvailabilityRequestBody { #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, @@ -172,6 +200,10 @@ pub struct ConnectionSettingParameter { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ConnectionSettingProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] pub client_id: Option, #[serde(rename = "settingId", default, skip_serializing_if = "Option::is_none")] @@ -202,12 +234,6 @@ pub struct DirectLineChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DirectLineChannelProperties { @@ -245,10 +271,6 @@ pub struct DirectLineSpeechChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DirectLineSpeechChannelProperties { @@ -271,10 +293,6 @@ pub struct EmailChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct EmailChannelProperties { @@ -301,10 +319,6 @@ pub struct FacebookChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct FacebookChannelProperties { @@ -403,17 +417,20 @@ pub struct LineRegistration { pub channel_access_token: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListChannelWithKeysResponse { + #[serde(flatten)] + pub bot_channel: BotChannel, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub setting: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MsTeamsChannel { #[serde(flatten)] pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MsTeamsChannelProperties { @@ -641,6 +658,17 @@ pub struct ServiceProviderResponseList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Site { + #[serde(flatten)] + pub web_chat_site: WebChatSite, + #[serde(flatten)] + pub direct_line_site: DirectLineSite, + #[serde(rename = "isTokenEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_token_enabled: Option, + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct SiteInfo { #[serde(rename = "siteName")] pub site_name: String, @@ -681,8 +709,6 @@ pub struct SkypeChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct SkypeChannelProperties { @@ -713,10 +739,6 @@ pub struct SlackChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct SlackChannelProperties { @@ -749,8 +771,6 @@ pub struct SmsChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct SmsChannelProperties { @@ -770,10 +790,6 @@ pub struct TelegramChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct TelegramChannelProperties { @@ -790,12 +806,6 @@ pub struct WebChatChannel { pub channel: Channel, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WebChatChannelProperties { diff --git a/services/mgmt/botservice/src/package_preview_2021_05/operations.rs b/services/mgmt/botservice/src/package_preview_2021_05/operations.rs index ee25db4311..f82da9bdbf 100644 --- a/services/mgmt/botservice/src/package_preview_2021_05/operations.rs +++ b/services/mgmt/botservice/src/package_preview_2021_05/operations.rs @@ -1281,7 +1281,9 @@ pub mod channels { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.BotService/botServices/{}/channels/{}/listChannelWithKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . channel_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; @@ -1303,7 +1305,7 @@ pub mod channels { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BotChannel = + let rsp_value: models::ListChannelWithKeysResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/cdn/Cargo.toml b/services/mgmt/cdn/Cargo.toml index 06c150a198..03b450f6ea 100644 --- a/services/mgmt/cdn/Cargo.toml +++ b/services/mgmt/cdn/Cargo.toml @@ -19,10 +19,11 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2020-09", "enable_reqwest"] +default = ["package-2021-06", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-06" = [] "package-2020-09" = [] "package-2020-04" = [] "package-2019-12" = [] diff --git a/services/mgmt/cdn/src/lib.rs b/services/mgmt/cdn/src/lib.rs index e0bea972d0..374d7f343b 100644 --- a/services/mgmt/cdn/src/lib.rs +++ b/services/mgmt/cdn/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-06")] +pub mod package_2021_06; +#[cfg(all(feature = "package-2021-06", not(feature = "no-default-version")))] +pub use package_2021_06::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2020-09")] pub mod package_2020_09; #[cfg(all(feature = "package-2020-09", not(feature = "no-default-version")))] diff --git a/services/mgmt/cdn/src/package_2019_04/models.rs b/services/mgmt/cdn/src/package_2019_04/models.rs index 7e6d55c60f..a03f0e1b01 100644 --- a/services/mgmt/cdn/src/package_2019_04/models.rs +++ b/services/mgmt/cdn/src/package_2019_04/models.rs @@ -1305,4 +1305,8 @@ pub struct CidrIpAddress { pub enum Transform { Lowercase, Uppercase, + Trim, + UrlDecode, + UrlEncode, + RemoveNulls, } diff --git a/services/mgmt/cdn/src/package_2019_06/models.rs b/services/mgmt/cdn/src/package_2019_06/models.rs index 3dca863074..0e12f8804d 100644 --- a/services/mgmt/cdn/src/package_2019_06/models.rs +++ b/services/mgmt/cdn/src/package_2019_06/models.rs @@ -1583,4 +1583,8 @@ pub mod policy_settings { pub enum Transform { Lowercase, Uppercase, + Trim, + UrlDecode, + UrlEncode, + RemoveNulls, } diff --git a/services/mgmt/cdn/src/package_2019_12/models.rs b/services/mgmt/cdn/src/package_2019_12/models.rs index 41df4f4efa..7095804a18 100644 --- a/services/mgmt/cdn/src/package_2019_12/models.rs +++ b/services/mgmt/cdn/src/package_2019_12/models.rs @@ -1485,4 +1485,8 @@ pub struct CidrIpAddress { pub enum Transform { Lowercase, Uppercase, + Trim, + UrlDecode, + UrlEncode, + RemoveNulls, } diff --git a/services/mgmt/cdn/src/package_2020_04/models.rs b/services/mgmt/cdn/src/package_2020_04/models.rs index b9e01b641d..422de70830 100644 --- a/services/mgmt/cdn/src/package_2020_04/models.rs +++ b/services/mgmt/cdn/src/package_2020_04/models.rs @@ -1848,4 +1848,8 @@ pub mod policy_settings { pub enum Transform { Lowercase, Uppercase, + Trim, + UrlDecode, + UrlEncode, + RemoveNulls, } diff --git a/services/mgmt/cdn/src/package_2020_09/models.rs b/services/mgmt/cdn/src/package_2020_09/models.rs index 5e5cba961b..7799a976cc 100644 --- a/services/mgmt/cdn/src/package_2020_09/models.rs +++ b/services/mgmt/cdn/src/package_2020_09/models.rs @@ -2678,4 +2678,8 @@ pub mod policy_settings { pub enum Transform { Lowercase, Uppercase, + Trim, + UrlDecode, + UrlEncode, + RemoveNulls, } diff --git a/services/mgmt/cdn/src/package_2021_06/mod.rs b/services/mgmt/cdn/src/package_2021_06/mod.rs new file mode 100644 index 0000000000..40e15441b6 --- /dev/null +++ b/services/mgmt/cdn/src/package_2021_06/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-06-01"; diff --git a/services/mgmt/cdn/src/package_2021_06/models.rs b/services/mgmt/cdn/src/package_2021_06/models.rs new file mode 100644 index 0000000000..cd30655b1e --- /dev/null +++ b/services/mgmt/cdn/src/package_2021_06/models.rs @@ -0,0 +1,3093 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdDomain { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdDomainHttpsParameters { + #[serde(rename = "certificateType")] + pub certificate_type: afd_domain_https_parameters::CertificateType, + #[serde(rename = "minimumTlsVersion", default, skip_serializing_if = "Option::is_none")] + pub minimum_tls_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +pub mod afd_domain_https_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CertificateType { + CustomerCertificate, + ManagedCertificate, + AzureFirstPartyManagedCertificate, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MinimumTlsVersion { + #[serde(rename = "TLS10")] + Tls10, + #[serde(rename = "TLS12")] + Tls12, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdDomainListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdDomainProperties { + #[serde(flatten)] + pub afd_domain_update_properties_parameters: AfdDomainUpdatePropertiesParameters, + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, + #[serde(rename = "domainValidationState", default, skip_serializing_if = "Option::is_none")] + pub domain_validation_state: Option, + #[serde(rename = "hostName")] + pub host_name: String, + #[serde(rename = "validationProperties", default, skip_serializing_if = "Option::is_none")] + pub validation_properties: Option, +} +pub mod afd_domain_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DomainValidationState { + Unknown, + Submitting, + Pending, + Rejected, + TimedOut, + PendingRevalidation, + Approved, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdDomainUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdDomainUpdatePropertiesParameters { + #[serde(rename = "profileName", default, skip_serializing_if = "Option::is_none")] + pub profile_name: Option, + #[serde(rename = "tlsSettings", default, skip_serializing_if = "Option::is_none")] + pub tls_settings: Option, + #[serde(rename = "azureDnsZone", default, skip_serializing_if = "Option::is_none")] + pub azure_dns_zone: Option, + #[serde(rename = "preValidatedCustomDomainResourceId", default, skip_serializing_if = "Option::is_none")] + pub pre_validated_custom_domain_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdEndpoint { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdEndpointListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdEndpointProperties { + #[serde(flatten)] + pub afd_endpoint_properties_update_parameters: AfdEndpointPropertiesUpdateParameters, + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdEndpointPropertiesUpdateParameters { + #[serde(rename = "profileName", default, skip_serializing_if = "Option::is_none")] + pub profile_name: Option, + #[serde(rename = "enabledState", default, skip_serializing_if = "Option::is_none")] + pub enabled_state: Option, + #[serde(rename = "originResponseTimeoutSeconds", default, skip_serializing_if = "Option::is_none")] + pub origin_response_timeout_seconds: Option, +} +pub mod afd_endpoint_properties_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnabledState { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AfdEndpointProtocols { + Http, + Https, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdEndpointUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOrigin { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginGroup { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginGroupListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginGroupProperties { + #[serde(flatten)] + pub afd_origin_group_update_properties_parameters: AfdOriginGroupUpdatePropertiesParameters, + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginGroupUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginGroupUpdatePropertiesParameters { + #[serde(rename = "profileName", default, skip_serializing_if = "Option::is_none")] + pub profile_name: Option, + #[serde(rename = "loadBalancingSettings", default, skip_serializing_if = "Option::is_none")] + pub load_balancing_settings: Option, + #[serde(rename = "healthProbeSettings", default, skip_serializing_if = "Option::is_none")] + pub health_probe_settings: Option, + #[serde( + rename = "trafficRestorationTimeToHealedOrNewEndpointsInMinutes", + default, + skip_serializing_if = "Option::is_none" + )] + pub traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Option, + #[serde( + rename = "responseBasedAfdOriginErrorDetectionSettings", + default, + skip_serializing_if = "Option::is_none" + )] + pub response_based_afd_origin_error_detection_settings: Option, + #[serde(rename = "sessionAffinityState", default, skip_serializing_if = "Option::is_none")] + pub session_affinity_state: Option, +} +pub mod afd_origin_group_update_properties_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SessionAffinityState { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginProperties { + #[serde(flatten)] + pub afd_origin_update_properties_parameters: AfdOriginUpdatePropertiesParameters, + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdOriginUpdatePropertiesParameters { + #[serde(rename = "originGroupName", default, skip_serializing_if = "Option::is_none")] + pub origin_group_name: Option, + #[serde(rename = "azureOrigin", default, skip_serializing_if = "Option::is_none")] + pub azure_origin: Option, + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[serde(rename = "httpPort", default, skip_serializing_if = "Option::is_none")] + pub http_port: Option, + #[serde(rename = "httpsPort", default, skip_serializing_if = "Option::is_none")] + pub https_port: Option, + #[serde(rename = "originHostHeader", default, skip_serializing_if = "Option::is_none")] + pub origin_host_header: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub weight: Option, + #[serde(rename = "sharedPrivateLinkResource", default, skip_serializing_if = "Option::is_none")] + pub shared_private_link_resource: Option, + #[serde(rename = "enabledState", default, skip_serializing_if = "Option::is_none")] + pub enabled_state: Option, + #[serde(rename = "enforceCertificateNameCheck", default, skip_serializing_if = "Option::is_none")] + pub enforce_certificate_name_check: Option, +} +pub mod afd_origin_update_properties_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnabledState { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdStateProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "deploymentStatus", default, skip_serializing_if = "Option::is_none")] + pub deployment_status: Option, +} +pub mod afd_state_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Failed, + Updating, + Deleting, + Creating, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeploymentStatus { + NotStarted, + InProgress, + Succeeded, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ActionType { + Allow, + Block, + Log, + Redirect, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivatedResourceReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "isActive", default, skip_serializing_if = "Option::is_none")] + pub is_active: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdPurgeParameters { + #[serde(rename = "contentPaths")] + pub content_paths: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub domains: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AfdRouteCacheConfiguration { + #[serde(rename = "queryStringCachingBehavior", default, skip_serializing_if = "Option::is_none")] + pub query_string_caching_behavior: Option, + #[serde(rename = "queryParameters", default, skip_serializing_if = "Option::is_none")] + pub query_parameters: Option, + #[serde(rename = "compressionSettings", default, skip_serializing_if = "Option::is_none")] + pub compression_settings: Option, +} +pub mod afd_route_cache_configuration { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum QueryStringCachingBehavior { + IgnoreQueryString, + UseQueryString, + IgnoreSpecifiedQueryStrings, + IncludeSpecifiedQueryStrings, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFirstPartyManagedCertificate { + #[serde(flatten)] + pub certificate: Certificate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFirstPartyManagedCertificateParameters { + #[serde(flatten)] + pub secret_parameters: SecretParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CacheConfiguration { + #[serde(rename = "queryStringCachingBehavior", default, skip_serializing_if = "Option::is_none")] + pub query_string_caching_behavior: Option, + #[serde(rename = "queryParameters", default, skip_serializing_if = "Option::is_none")] + pub query_parameters: Option, + #[serde(rename = "isCompressionEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_compression_enabled: Option, + #[serde(rename = "cacheBehavior", default, skip_serializing_if = "Option::is_none")] + pub cache_behavior: Option, + #[serde(rename = "cacheDuration", default, skip_serializing_if = "Option::is_none")] + pub cache_duration: Option, +} +pub mod cache_configuration { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum QueryStringCachingBehavior { + IgnoreQueryString, + UseQueryString, + IgnoreSpecifiedQueryStrings, + IncludeSpecifiedQueryStrings, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum IsCompressionEnabled { + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CacheBehavior { + HonorOrigin, + OverrideAlways, + OverrideIfOriginMissing, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CacheExpirationActionParameters { + #[serde(rename = "typeName")] + pub type_name: cache_expiration_action_parameters::TypeName, + #[serde(rename = "cacheBehavior")] + pub cache_behavior: cache_expiration_action_parameters::CacheBehavior, + #[serde(rename = "cacheType")] + pub cache_type: cache_expiration_action_parameters::CacheType, + #[serde(rename = "cacheDuration", default, skip_serializing_if = "Option::is_none")] + pub cache_duration: Option, +} +pub mod cache_expiration_action_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleCacheExpirationActionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CacheBehavior { + BypassCache, + Override, + SetIfMissing, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CacheType { + All, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CacheKeyQueryStringActionParameters { + #[serde(rename = "typeName")] + pub type_name: cache_key_query_string_action_parameters::TypeName, + #[serde(rename = "queryStringBehavior")] + pub query_string_behavior: cache_key_query_string_action_parameters::QueryStringBehavior, + #[serde(rename = "queryParameters", default, skip_serializing_if = "Option::is_none")] + pub query_parameters: Option, +} +pub mod cache_key_query_string_action_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleCacheKeyQueryStringBehaviorActionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum QueryStringBehavior { + Include, + IncludeAll, + Exclude, + ExcludeAll, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CdnCertificateSourceParameters { + #[serde(rename = "typeName")] + pub type_name: cdn_certificate_source_parameters::TypeName, + #[serde(rename = "certificateType")] + pub certificate_type: cdn_certificate_source_parameters::CertificateType, +} +pub mod cdn_certificate_source_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + CdnCertificateSourceParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CertificateType { + Shared, + Dedicated, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CdnEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CdnManagedHttpsParameters { + #[serde(flatten)] + pub custom_domain_https_parameters: CustomDomainHttpsParameters, + #[serde(rename = "certificateSourceParameters")] + pub certificate_source_parameters: CdnCertificateSourceParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CdnWebApplicationFirewallPolicy { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + pub sku: Sku, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CdnWebApplicationFirewallPolicyList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CdnWebApplicationFirewallPolicyPatchParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CdnWebApplicationFirewallPolicyProperties { + #[serde(rename = "policySettings", default, skip_serializing_if = "Option::is_none")] + pub policy_settings: Option, + #[serde(rename = "rateLimitRules", default, skip_serializing_if = "Option::is_none")] + pub rate_limit_rules: Option, + #[serde(rename = "customRules", default, skip_serializing_if = "Option::is_none")] + pub custom_rules: Option, + #[serde(rename = "managedRules", default, skip_serializing_if = "Option::is_none")] + pub managed_rules: Option, + #[serde(rename = "endpointLinks", default, skip_serializing_if = "Vec::is_empty")] + pub endpoint_links: Vec, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, +} +pub mod cdn_web_application_firewall_policy_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Succeeded, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceState { + Creating, + Enabling, + Enabled, + Disabling, + Disabled, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Certificate { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subject: Option, + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckHostNameAvailabilityInput { + #[serde(rename = "hostName")] + pub host_name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityInput { + pub name: String, + #[serde(rename = "type")] + pub type_: ResourceType, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityOutput { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientPortMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: client_port_match_condition_parameters::TypeName, + pub operator: client_port_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, +} +pub mod client_port_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleClientPortConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CompressionSettings { + #[serde(rename = "contentTypesToCompress", default, skip_serializing_if = "Vec::is_empty")] + pub content_types_to_compress: Vec, + #[serde(rename = "isCompressionEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_compression_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContinentsResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub continents: Vec, + #[serde(rename = "countryOrRegions", default, skip_serializing_if = "Vec::is_empty")] + pub country_or_regions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CookiesMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: cookies_match_condition_parameters::TypeName, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub selector: Option, + pub operator: cookies_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod cookies_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleCookiesConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomain { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainHttpsParameters { + #[serde(rename = "certificateSource")] + pub certificate_source: custom_domain_https_parameters::CertificateSource, + #[serde(rename = "protocolType")] + pub protocol_type: custom_domain_https_parameters::ProtocolType, + #[serde(rename = "minimumTlsVersion", default, skip_serializing_if = "Option::is_none")] + pub minimum_tls_version: Option, +} +pub mod custom_domain_https_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CertificateSource { + AzureKeyVault, + Cdn, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtocolType { + ServerNameIndication, + #[serde(rename = "IPBased")] + IpBased, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MinimumTlsVersion { + None, + #[serde(rename = "TLS10")] + Tls10, + #[serde(rename = "TLS12")] + Tls12, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainProperties { + #[serde(rename = "hostName")] + pub host_name: String, + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[serde(rename = "customHttpsProvisioningState", default, skip_serializing_if = "Option::is_none")] + pub custom_https_provisioning_state: Option, + #[serde(rename = "customHttpsProvisioningSubstate", default, skip_serializing_if = "Option::is_none")] + pub custom_https_provisioning_substate: Option, + #[serde(rename = "customHttpsParameters", default, skip_serializing_if = "Option::is_none")] + pub custom_https_parameters: Option, + #[serde(rename = "validationData", default, skip_serializing_if = "Option::is_none")] + pub validation_data: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod custom_domain_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceState { + Creating, + Active, + Deleting, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CustomHttpsProvisioningState { + Enabling, + Enabled, + Disabling, + Disabled, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CustomHttpsProvisioningSubstate { + SubmittingDomainControlValidationRequest, + PendingDomainControlValidationREquestApproval, + DomainControlValidationRequestApproved, + DomainControlValidationRequestRejected, + DomainControlValidationRequestTimedOut, + IssuingCertificate, + DeployingCertificate, + CertificateDeployed, + DeletingCertificate, + CertificateDeleted, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDomainPropertiesParameters { + #[serde(rename = "hostName")] + pub host_name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomRule { + pub name: String, + #[serde(rename = "enabledState", default, skip_serializing_if = "Option::is_none")] + pub enabled_state: Option, + pub priority: i32, + #[serde(rename = "matchConditions")] + pub match_conditions: Vec, + pub action: ActionType, +} +pub mod custom_rule { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnabledState { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomRuleList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomerCertificate { + #[serde(flatten)] + pub certificate: Certificate, + #[serde(rename = "secretSource", default, skip_serializing_if = "Option::is_none")] + pub secret_source: Option, + #[serde(rename = "secretVersion", default, skip_serializing_if = "Option::is_none")] + pub secret_version: Option, + #[serde(rename = "certificateAuthority", default, skip_serializing_if = "Option::is_none")] + pub certificate_authority: Option, + #[serde(rename = "useLatestVersion", default, skip_serializing_if = "Option::is_none")] + pub use_latest_version: Option, + #[serde(rename = "subjectAlternativeNames", default, skip_serializing_if = "Vec::is_empty")] + pub subject_alternative_names: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomerCertificateParameters { + #[serde(flatten)] + pub secret_parameters: SecretParameters, + #[serde(rename = "secretSource")] + pub secret_source: ResourceReference, + #[serde(rename = "secretVersion", default, skip_serializing_if = "Option::is_none")] + pub secret_version: Option, + #[serde(rename = "useLatestVersion", default, skip_serializing_if = "Option::is_none")] + pub use_latest_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subject: Option, + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, + #[serde(rename = "certificateAuthority", default, skip_serializing_if = "Option::is_none")] + pub certificate_authority: Option, + #[serde(rename = "subjectAlternativeNames", default, skip_serializing_if = "Vec::is_empty")] + pub subject_alternative_names: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeepCreatedOrigin { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeepCreatedOriginGroup { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeepCreatedOriginGroupProperties { + #[serde(rename = "healthProbeSettings", default, skip_serializing_if = "Option::is_none")] + pub health_probe_settings: Option, + pub origins: Vec, + #[serde( + rename = "trafficRestorationTimeToHealedOrNewEndpointsInMinutes", + default, + skip_serializing_if = "Option::is_none" + )] + pub traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Option, + #[serde( + rename = "responseBasedOriginErrorDetectionSettings", + default, + skip_serializing_if = "Option::is_none" + )] + pub response_based_origin_error_detection_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeepCreatedOriginProperties { + #[serde(rename = "hostName")] + pub host_name: String, + #[serde(rename = "httpPort", default, skip_serializing_if = "Option::is_none")] + pub http_port: Option, + #[serde(rename = "httpsPort", default, skip_serializing_if = "Option::is_none")] + pub https_port: Option, + #[serde(rename = "originHostHeader", default, skip_serializing_if = "Option::is_none")] + pub origin_host_header: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub weight: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "privateLinkAlias", default, skip_serializing_if = "Option::is_none")] + pub private_link_alias: Option, + #[serde(rename = "privateLinkResourceId", default, skip_serializing_if = "Option::is_none")] + pub private_link_resource_id: Option, + #[serde(rename = "privateLinkLocation", default, skip_serializing_if = "Option::is_none")] + pub private_link_location: Option, + #[serde(rename = "privateLinkApprovalMessage", default, skip_serializing_if = "Option::is_none")] + pub private_link_approval_message: Option, + #[serde(rename = "privateEndpointStatus", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRule { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + pub order: i32, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub conditions: Vec, + pub actions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleAction { + pub name: delivery_rule_action::Name, +} +pub mod delivery_rule_action { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + CacheExpiration, + CacheKeyQueryString, + ModifyRequestHeader, + ModifyResponseHeader, + UrlRedirect, + UrlRewrite, + UrlSigning, + OriginGroupOverride, + RouteConfigurationOverride, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleCacheExpirationAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: CacheExpirationActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleCacheKeyQueryStringAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: CacheKeyQueryStringActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleClientPortCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: ClientPortMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleCondition { + pub name: delivery_rule_condition::Name, +} +pub mod delivery_rule_condition { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + RemoteAddress, + RequestMethod, + QueryString, + PostArgs, + RequestUri, + RequestHeader, + RequestBody, + RequestScheme, + UrlPath, + UrlFileExtension, + UrlFileName, + HttpVersion, + Cookies, + IsDevice, + SocketAddr, + ClientPort, + ServerPort, + HostName, + SslProtocol, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleCookiesCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: CookiesMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleHostNameCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: HostNameMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleHttpVersionCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: HttpVersionMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleIsDeviceCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: IsDeviceMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRulePostArgsCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: PostArgsMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleQueryStringCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: QueryStringMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleRemoteAddressCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: RemoteAddressMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleRequestBodyCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: RequestBodyMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleRequestHeaderAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: HeaderActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleRequestHeaderCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: RequestHeaderMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleRequestMethodCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: RequestMethodMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleRequestSchemeCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: RequestSchemeMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleRequestUriCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: RequestUriMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleResponseHeaderAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: HeaderActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleRouteConfigurationOverrideAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: RouteConfigurationOverrideActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleServerPortCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: ServerPortMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleSocketAddrCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: SocketAddrMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleSslProtocolCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: SslProtocolMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleUrlFileExtensionCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: UrlFileExtensionMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleUrlFileNameCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: UrlFileNameMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeliveryRuleUrlPathCondition { + #[serde(flatten)] + pub delivery_rule_condition: DeliveryRuleCondition, + pub parameters: UrlPathMatchConditionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DimensionProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "internalName", default, skip_serializing_if = "Option::is_none")] + pub internal_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DomainValidationProperties { + #[serde(rename = "validationToken", default, skip_serializing_if = "Option::is_none")] + pub validation_token: Option, + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EdgeNode { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EdgeNodeProperties { + #[serde(rename = "ipAddressGroups")] + pub ip_address_groups: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EdgenodeResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Endpoint { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointProperties { + #[serde(flatten)] + pub endpoint_properties_update_parameters: EndpointPropertiesUpdateParameters, + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + pub origins: Vec, + #[serde(rename = "originGroups", default, skip_serializing_if = "Vec::is_empty")] + pub origin_groups: Vec, + #[serde(rename = "customDomains", default, skip_serializing_if = "Vec::is_empty")] + pub custom_domains: Vec, + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod endpoint_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceState { + Creating, + Deleting, + Running, + Starting, + Stopped, + Stopping, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointPropertiesUpdateParameters { + #[serde(rename = "originPath", default, skip_serializing_if = "Option::is_none")] + pub origin_path: Option, + #[serde(rename = "contentTypesToCompress", default, skip_serializing_if = "Vec::is_empty")] + pub content_types_to_compress: Vec, + #[serde(rename = "originHostHeader", default, skip_serializing_if = "Option::is_none")] + pub origin_host_header: Option, + #[serde(rename = "isCompressionEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_compression_enabled: Option, + #[serde(rename = "isHttpAllowed", default, skip_serializing_if = "Option::is_none")] + pub is_http_allowed: Option, + #[serde(rename = "isHttpsAllowed", default, skip_serializing_if = "Option::is_none")] + pub is_https_allowed: Option, + #[serde(rename = "queryStringCachingBehavior", default, skip_serializing_if = "Option::is_none")] + pub query_string_caching_behavior: Option, + #[serde(rename = "optimizationType", default, skip_serializing_if = "Option::is_none")] + pub optimization_type: Option, + #[serde(rename = "probePath", default, skip_serializing_if = "Option::is_none")] + pub probe_path: Option, + #[serde(rename = "geoFilters", default, skip_serializing_if = "Vec::is_empty")] + pub geo_filters: Vec, + #[serde(rename = "defaultOriginGroup", default, skip_serializing_if = "Option::is_none")] + pub default_origin_group: Option, + #[serde(rename = "urlSigningKeys", default, skip_serializing_if = "Vec::is_empty")] + pub url_signing_keys: Vec, + #[serde(rename = "deliveryPolicy", default, skip_serializing_if = "Option::is_none")] + pub delivery_policy: Option, + #[serde(rename = "webApplicationFirewallPolicyLink", default, skip_serializing_if = "Option::is_none")] + pub web_application_firewall_policy_link: Option, +} +pub mod endpoint_properties_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct DeliveryPolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + pub rules: Vec, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct WebApplicationFirewallPolicyLink { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GeoFilter { + #[serde(rename = "relativePath")] + pub relative_path: String, + pub action: geo_filter::Action, + #[serde(rename = "countryCodes")] + pub country_codes: Vec, +} +pub mod geo_filter { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Action { + Block, + Allow, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HeaderActionParameters { + #[serde(rename = "typeName")] + pub type_name: header_action_parameters::TypeName, + #[serde(rename = "headerAction")] + pub header_action: header_action_parameters::HeaderAction, + #[serde(rename = "headerName")] + pub header_name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +pub mod header_action_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleHeaderActionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HeaderAction { + Append, + Overwrite, + Delete, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HealthProbeParameters { + #[serde(rename = "probePath", default, skip_serializing_if = "Option::is_none")] + pub probe_path: Option, + #[serde(rename = "probeRequestType", default, skip_serializing_if = "Option::is_none")] + pub probe_request_type: Option, + #[serde(rename = "probeProtocol", default, skip_serializing_if = "Option::is_none")] + pub probe_protocol: Option, + #[serde(rename = "probeIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub probe_interval_in_seconds: Option, +} +pub mod health_probe_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProbeRequestType { + NotSet, + #[serde(rename = "GET")] + Get, + #[serde(rename = "HEAD")] + Head, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProbeProtocol { + NotSet, + Http, + Https, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HostNameMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: host_name_match_condition_parameters::TypeName, + pub operator: host_name_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod host_name_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleHostNameConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpErrorRangeParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub begin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpVersionMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: http_version_match_condition_parameters::TypeName, + pub operator: http_version_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod http_version_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleHttpVersionConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Equal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IdentityType { + #[serde(rename = "user")] + User, + #[serde(rename = "application")] + Application, + #[serde(rename = "managedIdentity")] + ManagedIdentity, + #[serde(rename = "key")] + Key, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpAddressGroup { + #[serde(rename = "deliveryRegion", default, skip_serializing_if = "Option::is_none")] + pub delivery_region: Option, + #[serde(rename = "ipv4Addresses", default, skip_serializing_if = "Vec::is_empty")] + pub ipv4_addresses: Vec, + #[serde(rename = "ipv6Addresses", default, skip_serializing_if = "Vec::is_empty")] + pub ipv6_addresses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IsDeviceMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: is_device_match_condition_parameters::TypeName, + pub operator: is_device_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, +} +pub mod is_device_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleIsDeviceConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Equal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultCertificateSourceParameters { + #[serde(rename = "typeName")] + pub type_name: key_vault_certificate_source_parameters::TypeName, + #[serde(rename = "subscriptionId")] + pub subscription_id: String, + #[serde(rename = "resourceGroupName")] + pub resource_group_name: String, + #[serde(rename = "vaultName")] + pub vault_name: String, + #[serde(rename = "secretName")] + pub secret_name: String, + #[serde(rename = "secretVersion", default, skip_serializing_if = "Option::is_none")] + pub secret_version: Option, + #[serde(rename = "updateRule")] + pub update_rule: key_vault_certificate_source_parameters::UpdateRule, + #[serde(rename = "deleteRule")] + pub delete_rule: key_vault_certificate_source_parameters::DeleteRule, +} +pub mod key_vault_certificate_source_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + KeyVaultCertificateSourceParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpdateRule { + NoAction, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteRule { + NoAction, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultSigningKeyParameters { + #[serde(rename = "typeName")] + pub type_name: key_vault_signing_key_parameters::TypeName, + #[serde(rename = "subscriptionId")] + pub subscription_id: String, + #[serde(rename = "resourceGroupName")] + pub resource_group_name: String, + #[serde(rename = "vaultName")] + pub vault_name: String, + #[serde(rename = "secretName")] + pub secret_name: String, + #[serde(rename = "secretVersion")] + pub secret_version: String, +} +pub mod key_vault_signing_key_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + KeyVaultSigningKeyParameters, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancingSettingsParameters { + #[serde(rename = "sampleSize", default, skip_serializing_if = "Option::is_none")] + pub sample_size: Option, + #[serde(rename = "successfulSamplesRequired", default, skip_serializing_if = "Option::is_none")] + pub successful_samples_required: Option, + #[serde(rename = "additionalLatencyInMilliseconds", default, skip_serializing_if = "Option::is_none")] + pub additional_latency_in_milliseconds: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadParameters { + #[serde(rename = "contentPaths")] + pub content_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, + #[serde(rename = "logFilterPattern", default, skip_serializing_if = "Option::is_none")] + pub log_filter_pattern: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCertificate { + #[serde(flatten)] + pub certificate: Certificate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCertificateParameters { + #[serde(flatten)] + pub secret_parameters: SecretParameters, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subject: Option, + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleDefinition { + #[serde(rename = "ruleId", default, skip_serializing_if = "Option::is_none")] + pub rule_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleGroupDefinition { + #[serde(rename = "ruleGroupName", default, skip_serializing_if = "Option::is_none")] + pub rule_group_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleGroupOverride { + #[serde(rename = "ruleGroupName")] + pub rule_group_name: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleOverride { + #[serde(rename = "ruleId")] + pub rule_id: String, + #[serde(rename = "enabledState", default, skip_serializing_if = "Option::is_none")] + pub enabled_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, +} +pub mod managed_rule_override { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnabledState { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleSet { + #[serde(rename = "ruleSetType")] + pub rule_set_type: String, + #[serde(rename = "ruleSetVersion")] + pub rule_set_version: String, + #[serde(rename = "anomalyScore", default, skip_serializing_if = "Option::is_none")] + pub anomaly_score: Option, + #[serde(rename = "ruleGroupOverrides", default, skip_serializing_if = "Vec::is_empty")] + pub rule_group_overrides: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleSetDefinition { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleSetDefinitionList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleSetDefinitionProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "ruleSetType", default, skip_serializing_if = "Option::is_none")] + pub rule_set_type: Option, + #[serde(rename = "ruleSetVersion", default, skip_serializing_if = "Option::is_none")] + pub rule_set_version: Option, + #[serde(rename = "ruleGroups", default, skip_serializing_if = "Vec::is_empty")] + pub rule_groups: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleSetList { + #[serde(rename = "managedRuleSets", default, skip_serializing_if = "Vec::is_empty")] + pub managed_rule_sets: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedServiceIdentity { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, +} +pub mod managed_service_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MatchCondition { + #[serde(rename = "matchVariable")] + pub match_variable: match_condition::MatchVariable, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub selector: Option, + pub operator: match_condition::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValue")] + pub match_value: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod match_condition { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MatchVariable { + RemoteAddr, + SocketAddr, + RequestMethod, + RequestHeader, + RequestUri, + QueryString, + RequestBody, + Cookies, + PostArgs, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + #[serde(rename = "IPMatch")] + IpMatch, + GeoMatch, + Equal, + Contains, + LessThan, + GreaterThan, + LessThanOrEqual, + GreaterThanOrEqual, + BeginsWith, + EndsWith, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricAvailability { + #[serde(rename = "timeGrain", default, skip_serializing_if = "Option::is_none")] + pub time_grain: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub availabilities: Vec, + #[serde(rename = "supportedTimeGrainTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_time_grain_types: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dimensions: Vec, + #[serde(rename = "fillGapWithZero", default, skip_serializing_if = "Option::is_none")] + pub fill_gap_with_zero: Option, + #[serde(rename = "metricFilterPattern", default, skip_serializing_if = "Option::is_none")] + pub metric_filter_pattern: Option, + #[serde(rename = "isInternal", default, skip_serializing_if = "Option::is_none")] + pub is_internal: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricsResponse { + #[serde(rename = "dateTimeBegin", default, skip_serializing_if = "Option::is_none")] + pub date_time_begin: Option, + #[serde(rename = "dateTimeEnd", default, skip_serializing_if = "Option::is_none")] + pub date_time_end: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub granularity: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub series: Vec, +} +pub mod metrics_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Granularity { + #[serde(rename = "PT5M")] + Pt5m, + #[serde(rename = "PT1H")] + Pt1h, + #[serde(rename = "P1D")] + P1d, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationProperties { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OptimizationType { + GeneralWebDelivery, + GeneralMediaStreaming, + VideoOnDemandMediaStreaming, + LargeFileDownload, + DynamicSiteAcceleration, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Origin { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginGroup { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginGroupListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginGroupOverride { + #[serde(rename = "originGroup", default, skip_serializing_if = "Option::is_none")] + pub origin_group: Option, + #[serde(rename = "forwardingProtocol", default, skip_serializing_if = "Option::is_none")] + pub forwarding_protocol: Option, +} +pub mod origin_group_override { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ForwardingProtocol { + HttpOnly, + HttpsOnly, + MatchRequest, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginGroupOverrideAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: OriginGroupOverrideActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginGroupOverrideActionParameters { + #[serde(rename = "typeName")] + pub type_name: origin_group_override_action_parameters::TypeName, + #[serde(rename = "originGroup")] + pub origin_group: ResourceReference, +} +pub mod origin_group_override_action_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleOriginGroupOverrideActionParameters, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginGroupProperties { + #[serde(flatten)] + pub origin_group_update_properties_parameters: OriginGroupUpdatePropertiesParameters, + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod origin_group_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceState { + Creating, + Active, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginGroupUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginGroupUpdatePropertiesParameters { + #[serde(rename = "healthProbeSettings", default, skip_serializing_if = "Option::is_none")] + pub health_probe_settings: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub origins: Vec, + #[serde( + rename = "trafficRestorationTimeToHealedOrNewEndpointsInMinutes", + default, + skip_serializing_if = "Option::is_none" + )] + pub traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Option, + #[serde( + rename = "responseBasedOriginErrorDetectionSettings", + default, + skip_serializing_if = "Option::is_none" + )] + pub response_based_origin_error_detection_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginProperties { + #[serde(flatten)] + pub origin_update_properties_parameters: OriginUpdatePropertiesParameters, + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpointStatus", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_status: Option, +} +pub mod origin_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceState { + Creating, + Active, + Deleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OriginUpdatePropertiesParameters { + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[serde(rename = "httpPort", default, skip_serializing_if = "Option::is_none")] + pub http_port: Option, + #[serde(rename = "httpsPort", default, skip_serializing_if = "Option::is_none")] + pub https_port: Option, + #[serde(rename = "originHostHeader", default, skip_serializing_if = "Option::is_none")] + pub origin_host_header: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub weight: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "privateLinkAlias", default, skip_serializing_if = "Option::is_none")] + pub private_link_alias: Option, + #[serde(rename = "privateLinkResourceId", default, skip_serializing_if = "Option::is_none")] + pub private_link_resource_id: Option, + #[serde(rename = "privateLinkLocation", default, skip_serializing_if = "Option::is_none")] + pub private_link_location: Option, + #[serde(rename = "privateLinkApprovalMessage", default, skip_serializing_if = "Option::is_none")] + pub private_link_approval_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PostArgsMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: post_args_match_condition_parameters::TypeName, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub selector: Option, + pub operator: post_args_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod post_args_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRulePostArgsConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointStatus { + Pending, + Approved, + Rejected, + Disconnected, + Timeout, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Profile { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + pub sku: Sku, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProfileListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProfileProperties { + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "frontDoorId", default, skip_serializing_if = "Option::is_none")] + pub front_door_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(rename = "originResponseTimeoutSeconds", default, skip_serializing_if = "Option::is_none")] + pub origin_response_timeout_seconds: Option, +} +pub mod profile_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceState { + Creating, + Active, + Deleting, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProfileUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PurgeParameters { + #[serde(rename = "contentPaths")] + pub content_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum QueryStringCachingBehavior { + IgnoreQueryString, + BypassCaching, + UseQueryString, + NotSet, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryStringMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: query_string_match_condition_parameters::TypeName, + pub operator: query_string_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod query_string_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleQueryStringConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RankingsResponse { + #[serde(rename = "dateTimeBegin", default, skip_serializing_if = "Option::is_none")] + pub date_time_begin: Option, + #[serde(rename = "dateTimeEnd", default, skip_serializing_if = "Option::is_none")] + pub date_time_end: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tables: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RateLimitRule { + #[serde(flatten)] + pub custom_rule: CustomRule, + #[serde(rename = "rateLimitThreshold")] + pub rate_limit_threshold: i32, + #[serde(rename = "rateLimitDurationInMinutes")] + pub rate_limit_duration_in_minutes: i32, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RateLimitRuleList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RemoteAddressMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: remote_address_match_condition_parameters::TypeName, + pub operator: remote_address_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod remote_address_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleRemoteAddressConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + #[serde(rename = "IPMatch")] + IpMatch, + GeoMatch, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RequestBodyMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: request_body_match_condition_parameters::TypeName, + pub operator: request_body_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod request_body_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleRequestBodyConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RequestHeaderMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: request_header_match_condition_parameters::TypeName, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub selector: Option, + pub operator: request_header_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod request_header_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleRequestHeaderConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RequestMethodMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: request_method_match_condition_parameters::TypeName, + pub operator: request_method_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, +} +pub mod request_method_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleRequestMethodConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Equal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RequestSchemeMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: request_scheme_match_condition_parameters::TypeName, + pub operator: request_scheme_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, +} +pub mod request_scheme_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleRequestSchemeConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Equal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RequestUriMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: request_uri_match_condition_parameters::TypeName, + pub operator: request_uri_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod request_uri_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleRequestUriConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ResourceType { + #[serde(rename = "Microsoft.Cdn/Profiles/Endpoints")] + MicrosoftCdnProfilesEndpoints, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceUsage { + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceUsageListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourcesResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, + #[serde(rename = "customDomains", default, skip_serializing_if = "Vec::is_empty")] + pub custom_domains: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResponseBasedOriginErrorDetectionParameters { + #[serde(rename = "responseBasedDetectedErrorTypes", default, skip_serializing_if = "Option::is_none")] + pub response_based_detected_error_types: Option, + #[serde( + rename = "responseBasedFailoverThresholdPercentage", + default, + skip_serializing_if = "Option::is_none" + )] + pub response_based_failover_threshold_percentage: Option, + #[serde(rename = "httpErrorRanges", default, skip_serializing_if = "Vec::is_empty")] + pub http_error_ranges: Vec, +} +pub mod response_based_origin_error_detection_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResponseBasedDetectedErrorTypes { + None, + TcpErrorsOnly, + TcpAndHttpErrors, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Route { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RouteConfigurationOverrideActionParameters { + #[serde(rename = "typeName")] + pub type_name: route_configuration_override_action_parameters::TypeName, + #[serde(rename = "originGroupOverride", default, skip_serializing_if = "Option::is_none")] + pub origin_group_override: Option, + #[serde(rename = "cacheConfiguration", default, skip_serializing_if = "Option::is_none")] + pub cache_configuration: Option, +} +pub mod route_configuration_override_action_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleRouteConfigurationOverrideActionParameters, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RouteListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RouteProperties { + #[serde(flatten)] + pub route_update_properties_parameters: RouteUpdatePropertiesParameters, + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RouteUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RouteUpdatePropertiesParameters { + #[serde(rename = "endpointName", default, skip_serializing_if = "Option::is_none")] + pub endpoint_name: Option, + #[serde(rename = "customDomains", default, skip_serializing_if = "Vec::is_empty")] + pub custom_domains: Vec, + #[serde(rename = "originGroup", default, skip_serializing_if = "Option::is_none")] + pub origin_group: Option, + #[serde(rename = "originPath", default, skip_serializing_if = "Option::is_none")] + pub origin_path: Option, + #[serde(rename = "ruleSets", default, skip_serializing_if = "Vec::is_empty")] + pub rule_sets: Vec, + #[serde(rename = "supportedProtocols", default, skip_serializing_if = "Vec::is_empty")] + pub supported_protocols: Vec, + #[serde(rename = "patternsToMatch", default, skip_serializing_if = "Vec::is_empty")] + pub patterns_to_match: Vec, + #[serde(rename = "cacheConfiguration", default, skip_serializing_if = "Option::is_none")] + pub cache_configuration: Option, + #[serde(rename = "forwardingProtocol", default, skip_serializing_if = "Option::is_none")] + pub forwarding_protocol: Option, + #[serde(rename = "linkToDefaultDomain", default, skip_serializing_if = "Option::is_none")] + pub link_to_default_domain: Option, + #[serde(rename = "httpsRedirect", default, skip_serializing_if = "Option::is_none")] + pub https_redirect: Option, + #[serde(rename = "enabledState", default, skip_serializing_if = "Option::is_none")] + pub enabled_state: Option, +} +pub mod route_update_properties_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ForwardingProtocol { + HttpOnly, + HttpsOnly, + MatchRequest, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LinkToDefaultDomain { + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HttpsRedirect { + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnabledState { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Rule { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RuleListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RuleProperties { + #[serde(flatten)] + pub rule_update_properties_parameters: RuleUpdatePropertiesParameters, + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RuleSet { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RuleSetListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RuleSetProperties { + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, + #[serde(rename = "profileName", default, skip_serializing_if = "Option::is_none")] + pub profile_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RuleUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RuleUpdatePropertiesParameters { + #[serde(rename = "ruleSetName", default, skip_serializing_if = "Option::is_none")] + pub rule_set_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub order: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub conditions: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, + #[serde(rename = "matchProcessingBehavior", default, skip_serializing_if = "Option::is_none")] + pub match_processing_behavior: Option, +} +pub mod rule_update_properties_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MatchProcessingBehavior { + Continue, + Stop, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Secret { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretParameters { + #[serde(rename = "type")] + pub type_: SecretType, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretProperties { + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, + #[serde(rename = "profileName", default, skip_serializing_if = "Option::is_none")] + pub profile_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SecretType { + UrlSigningKey, + CustomerCertificate, + ManagedCertificate, + AzureFirstPartyManagedCertificate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityPolicy { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityPolicyListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityPolicyParameters { + #[serde(rename = "type")] + pub type_: security_policy_parameters::Type, +} +pub mod security_policy_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + WebApplicationFirewall, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityPolicyProperties { + #[serde(flatten)] + pub afd_state_properties: AfdStateProperties, + #[serde(rename = "profileName", default, skip_serializing_if = "Option::is_none")] + pub profile_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityPolicyWebApplicationFirewallAssociation { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub domains: Vec, + #[serde(rename = "patternsToMatch", default, skip_serializing_if = "Vec::is_empty")] + pub patterns_to_match: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityPolicyWebApplicationFirewallParameters { + #[serde(flatten)] + pub security_policy_parameters: SecurityPolicyParameters, + #[serde(rename = "wafPolicy", default, skip_serializing_if = "Option::is_none")] + pub waf_policy: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub associations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServerPortMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: server_port_match_condition_parameters::TypeName, + pub operator: server_port_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, +} +pub mod server_port_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleServerPortConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceSpecification { + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedPrivateLinkResourceProperties { + #[serde(rename = "privateLink", default, skip_serializing_if = "Option::is_none")] + pub private_link: Option, + #[serde(rename = "privateLinkLocation", default, skip_serializing_if = "Option::is_none")] + pub private_link_location: Option, + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requestMessage", default, skip_serializing_if = "Option::is_none")] + pub request_message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod shared_private_link_resource_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + Timeout, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +pub mod sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "Standard_Verizon")] + StandardVerizon, + #[serde(rename = "Premium_Verizon")] + PremiumVerizon, + #[serde(rename = "Custom_Verizon")] + CustomVerizon, + #[serde(rename = "Standard_Akamai")] + StandardAkamai, + #[serde(rename = "Standard_ChinaCdn")] + StandardChinaCdn, + #[serde(rename = "Standard_Microsoft")] + StandardMicrosoft, + #[serde(rename = "Standard_AzureFrontDoor")] + StandardAzureFrontDoor, + #[serde(rename = "Premium_AzureFrontDoor")] + PremiumAzureFrontDoor, + #[serde(rename = "Standard_955BandWidth_ChinaCdn")] + Standard955bandWidthChinaCdn, + #[serde(rename = "Standard_AvgBandWidth_ChinaCdn")] + StandardAvgBandWidthChinaCdn, + #[serde(rename = "StandardPlus_ChinaCdn")] + StandardPlusChinaCdn, + #[serde(rename = "StandardPlus_955BandWidth_ChinaCdn")] + StandardPlus955bandWidthChinaCdn, + #[serde(rename = "StandardPlus_AvgBandWidth_ChinaCdn")] + StandardPlusAvgBandWidthChinaCdn, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SocketAddrMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: socket_addr_match_condition_parameters::TypeName, + pub operator: socket_addr_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, +} +pub mod socket_addr_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleSocketAddrConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + #[serde(rename = "IPMatch")] + IpMatch, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SslProtocol { + #[serde(rename = "TLSv1")] + TlSv1, + #[serde(rename = "TLSv1.1")] + TlSv11, + #[serde(rename = "TLSv1.2")] + TlSv12, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SslProtocolMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: ssl_protocol_match_condition_parameters::TypeName, + pub operator: ssl_protocol_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, +} +pub mod ssl_protocol_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleSslProtocolConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Equal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SsoUri { + #[serde(rename = "ssoUriValue", default, skip_serializing_if = "Option::is_none")] + pub sso_uri_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedOptimizationTypesListResult { + #[serde(rename = "supportedOptimizationTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_optimization_types: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TransformType { + Lowercase, + Uppercase, + Trim, + UrlDecode, + UrlEncode, + RemoveNulls, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlFileExtensionMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: url_file_extension_match_condition_parameters::TypeName, + pub operator: url_file_extension_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod url_file_extension_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleUrlFileExtensionMatchConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlFileNameMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: url_file_name_match_condition_parameters::TypeName, + pub operator: url_file_name_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod url_file_name_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleUrlFilenameConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlPathMatchConditionParameters { + #[serde(rename = "typeName")] + pub type_name: url_path_match_condition_parameters::TypeName, + pub operator: url_path_match_condition_parameters::Operator, + #[serde(rename = "negateCondition", default, skip_serializing_if = "Option::is_none")] + pub negate_condition: Option, + #[serde(rename = "matchValues", default, skip_serializing_if = "Vec::is_empty")] + pub match_values: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +pub mod url_path_match_condition_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleUrlPathMatchConditionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Any, + Equal, + Contains, + BeginsWith, + EndsWith, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, + Wildcard, + RegEx, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlRedirectAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: UrlRedirectActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlRedirectActionParameters { + #[serde(rename = "typeName")] + pub type_name: url_redirect_action_parameters::TypeName, + #[serde(rename = "redirectType")] + pub redirect_type: url_redirect_action_parameters::RedirectType, + #[serde(rename = "destinationProtocol", default, skip_serializing_if = "Option::is_none")] + pub destination_protocol: Option, + #[serde(rename = "customPath", default, skip_serializing_if = "Option::is_none")] + pub custom_path: Option, + #[serde(rename = "customHostname", default, skip_serializing_if = "Option::is_none")] + pub custom_hostname: Option, + #[serde(rename = "customQueryString", default, skip_serializing_if = "Option::is_none")] + pub custom_query_string: Option, + #[serde(rename = "customFragment", default, skip_serializing_if = "Option::is_none")] + pub custom_fragment: Option, +} +pub mod url_redirect_action_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleUrlRedirectActionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RedirectType { + Moved, + Found, + TemporaryRedirect, + PermanentRedirect, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DestinationProtocol { + MatchRequest, + Http, + Https, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlRewriteAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: UrlRewriteActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlRewriteActionParameters { + #[serde(rename = "typeName")] + pub type_name: url_rewrite_action_parameters::TypeName, + #[serde(rename = "sourcePattern")] + pub source_pattern: String, + pub destination: String, + #[serde(rename = "preserveUnmatchedPath", default, skip_serializing_if = "Option::is_none")] + pub preserve_unmatched_path: Option, +} +pub mod url_rewrite_action_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleUrlRewriteActionParameters, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlSigningAction { + #[serde(flatten)] + pub delivery_rule_action: DeliveryRuleAction, + pub parameters: UrlSigningActionParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlSigningActionParameters { + #[serde(rename = "typeName")] + pub type_name: url_signing_action_parameters::TypeName, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub algorithm: Option, + #[serde(rename = "parameterNameOverride", default, skip_serializing_if = "Vec::is_empty")] + pub parameter_name_override: Vec, +} +pub mod url_signing_action_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TypeName { + DeliveryRuleUrlSigningActionParameters, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Algorithm { + #[serde(rename = "SHA256")] + Sha256, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlSigningKey { + #[serde(rename = "keyId")] + pub key_id: String, + #[serde(rename = "keySourceParameters")] + pub key_source_parameters: KeyVaultSigningKeyParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlSigningKeyParameters { + #[serde(flatten)] + pub secret_parameters: SecretParameters, + #[serde(rename = "keyId")] + pub key_id: String, + #[serde(rename = "secretSource")] + pub secret_source: ResourceReference, + #[serde(rename = "secretVersion", default, skip_serializing_if = "Option::is_none")] + pub secret_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UrlSigningParamIdentifier { + #[serde(rename = "paramIndicator")] + pub param_indicator: url_signing_param_identifier::ParamIndicator, + #[serde(rename = "paramName")] + pub param_name: String, +} +pub mod url_signing_param_identifier { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ParamIndicator { + Expires, + KeyId, + Signature, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Usage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + pub unit: usage::Unit, + #[serde(rename = "currentValue")] + pub current_value: i64, + pub limit: i64, + pub name: UsageName, +} +pub mod usage { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UsageName { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UsagesListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserManagedHttpsParameters { + #[serde(flatten)] + pub custom_domain_https_parameters: CustomDomainHttpsParameters, + #[serde(rename = "certificateSourceParameters")] + pub certificate_source_parameters: KeyVaultCertificateSourceParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateCustomDomainInput { + #[serde(rename = "hostName")] + pub host_name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateCustomDomainOutput { + #[serde(rename = "customDomainValidated", default, skip_serializing_if = "Option::is_none")] + pub custom_domain_validated: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateProbeInput { + #[serde(rename = "probeURL")] + pub probe_url: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateProbeOutput { + #[serde(rename = "isValid", default, skip_serializing_if = "Option::is_none")] + pub is_valid: Option, + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateSecretInput { + #[serde(rename = "secretType")] + pub secret_type: SecretType, + #[serde(rename = "secretSource")] + pub secret_source: ResourceReference, + #[serde(rename = "secretVersion", default, skip_serializing_if = "Option::is_none")] + pub secret_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateSecretOutput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +pub mod validate_secret_output { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Valid, + Invalid, + AccessDenied, + CertificateExpired, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidationToken { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub token: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WafMetricsResponse { + #[serde(rename = "dateTimeBegin", default, skip_serializing_if = "Option::is_none")] + pub date_time_begin: Option, + #[serde(rename = "dateTimeEnd", default, skip_serializing_if = "Option::is_none")] + pub date_time_end: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub granularity: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub series: Vec, +} +pub mod waf_metrics_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Granularity { + #[serde(rename = "PT5M")] + Pt5m, + #[serde(rename = "PT1H")] + Pt1h, + #[serde(rename = "P1D")] + P1d, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WafRankingsResponse { + #[serde(rename = "dateTimeBegin", default, skip_serializing_if = "Option::is_none")] + pub date_time_begin: Option, + #[serde(rename = "dateTimeEnd", default, skip_serializing_if = "Option::is_none")] + pub date_time_end: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub groups: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub data: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CidrIpAddress { + #[serde(rename = "baseIpAddress", default, skip_serializing_if = "Option::is_none")] + pub base_ip_address: Option, + #[serde(rename = "prefixLength", default, skip_serializing_if = "Option::is_none")] + pub prefix_length: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicySettings { + #[serde(rename = "enabledState", default, skip_serializing_if = "Option::is_none")] + pub enabled_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "defaultRedirectUrl", default, skip_serializing_if = "Option::is_none")] + pub default_redirect_url: Option, + #[serde(rename = "defaultCustomBlockResponseStatusCode", default, skip_serializing_if = "Option::is_none")] + pub default_custom_block_response_status_code: Option, + #[serde(rename = "defaultCustomBlockResponseBody", default, skip_serializing_if = "Option::is_none")] + pub default_custom_block_response_body: Option, +} +pub mod policy_settings { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnabledState { + Disabled, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + Prevention, + Detection, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DefaultCustomBlockResponseStatusCode {} +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Transform { + Lowercase, + Uppercase, + Trim, + UrlDecode, + UrlEncode, + RemoveNulls, +} diff --git a/services/mgmt/cdn/src/package_2021_06/operations.rs b/services/mgmt/cdn/src/package_2021_06/operations.rs new file mode 100644 index 0000000000..34ef16f0e9 --- /dev/null +++ b/services/mgmt/cdn/src/package_2021_06/operations.rs @@ -0,0 +1,11145 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn afd_custom_domains(&self) -> afd_custom_domains::Client { + afd_custom_domains::Client(self.clone()) + } + pub fn afd_endpoints(&self) -> afd_endpoints::Client { + afd_endpoints::Client(self.clone()) + } + pub fn afd_origin_groups(&self) -> afd_origin_groups::Client { + afd_origin_groups::Client(self.clone()) + } + pub fn afd_origins(&self) -> afd_origins::Client { + afd_origins::Client(self.clone()) + } + pub fn afd_profiles(&self) -> afd_profiles::Client { + afd_profiles::Client(self.clone()) + } + pub fn custom_domains(&self) -> custom_domains::Client { + custom_domains::Client(self.clone()) + } + pub fn edge_nodes(&self) -> edge_nodes::Client { + edge_nodes::Client(self.clone()) + } + pub fn endpoints(&self) -> endpoints::Client { + endpoints::Client(self.clone()) + } + pub fn log_analytics(&self) -> log_analytics::Client { + log_analytics::Client(self.clone()) + } + pub fn managed_rule_sets(&self) -> managed_rule_sets::Client { + managed_rule_sets::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn origin_groups(&self) -> origin_groups::Client { + origin_groups::Client(self.clone()) + } + pub fn origins(&self) -> origins::Client { + origins::Client(self.clone()) + } + pub fn policies(&self) -> policies::Client { + policies::Client(self.clone()) + } + pub fn profiles(&self) -> profiles::Client { + profiles::Client(self.clone()) + } + pub fn resource_usage(&self) -> resource_usage::Client { + resource_usage::Client(self.clone()) + } + pub fn routes(&self) -> routes::Client { + routes::Client(self.clone()) + } + pub fn rule_sets(&self) -> rule_sets::Client { + rule_sets::Client(self.clone()) + } + pub fn rules(&self) -> rules::Client { + rules::Client(self.clone()) + } + pub fn secrets(&self) -> secrets::Client { + secrets::Client(self.clone()) + } + pub fn security_policies(&self) -> security_policies::Client { + security_policies::Client(self.clone()) + } + pub fn validate(&self) -> validate::Client { + validate::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + AfdProfiles_ListResourceUsage(#[from] afd_profiles::list_resource_usage::Error), + #[error(transparent)] + AfdProfiles_CheckHostNameAvailability(#[from] afd_profiles::check_host_name_availability::Error), + #[error(transparent)] + AfdCustomDomains_ListByProfile(#[from] afd_custom_domains::list_by_profile::Error), + #[error(transparent)] + AfdCustomDomains_Get(#[from] afd_custom_domains::get::Error), + #[error(transparent)] + AfdCustomDomains_Create(#[from] afd_custom_domains::create::Error), + #[error(transparent)] + AfdCustomDomains_Update(#[from] afd_custom_domains::update::Error), + #[error(transparent)] + AfdCustomDomains_Delete(#[from] afd_custom_domains::delete::Error), + #[error(transparent)] + AfdCustomDomains_RefreshValidationToken(#[from] afd_custom_domains::refresh_validation_token::Error), + #[error(transparent)] + AfdEndpoints_ListByProfile(#[from] afd_endpoints::list_by_profile::Error), + #[error(transparent)] + AfdEndpoints_Get(#[from] afd_endpoints::get::Error), + #[error(transparent)] + AfdEndpoints_Create(#[from] afd_endpoints::create::Error), + #[error(transparent)] + AfdEndpoints_Update(#[from] afd_endpoints::update::Error), + #[error(transparent)] + AfdEndpoints_Delete(#[from] afd_endpoints::delete::Error), + #[error(transparent)] + AfdEndpoints_PurgeContent(#[from] afd_endpoints::purge_content::Error), + #[error(transparent)] + AfdEndpoints_ListResourceUsage(#[from] afd_endpoints::list_resource_usage::Error), + #[error(transparent)] + AfdEndpoints_ValidateCustomDomain(#[from] afd_endpoints::validate_custom_domain::Error), + #[error(transparent)] + AfdOriginGroups_ListByProfile(#[from] afd_origin_groups::list_by_profile::Error), + #[error(transparent)] + AfdOriginGroups_Get(#[from] afd_origin_groups::get::Error), + #[error(transparent)] + AfdOriginGroups_Create(#[from] afd_origin_groups::create::Error), + #[error(transparent)] + AfdOriginGroups_Update(#[from] afd_origin_groups::update::Error), + #[error(transparent)] + AfdOriginGroups_Delete(#[from] afd_origin_groups::delete::Error), + #[error(transparent)] + AfdOriginGroups_ListResourceUsage(#[from] afd_origin_groups::list_resource_usage::Error), + #[error(transparent)] + AfdOrigins_ListByOriginGroup(#[from] afd_origins::list_by_origin_group::Error), + #[error(transparent)] + AfdOrigins_Get(#[from] afd_origins::get::Error), + #[error(transparent)] + AfdOrigins_Create(#[from] afd_origins::create::Error), + #[error(transparent)] + AfdOrigins_Update(#[from] afd_origins::update::Error), + #[error(transparent)] + AfdOrigins_Delete(#[from] afd_origins::delete::Error), + #[error(transparent)] + Routes_ListByEndpoint(#[from] routes::list_by_endpoint::Error), + #[error(transparent)] + Routes_Get(#[from] routes::get::Error), + #[error(transparent)] + Routes_Create(#[from] routes::create::Error), + #[error(transparent)] + Routes_Update(#[from] routes::update::Error), + #[error(transparent)] + Routes_Delete(#[from] routes::delete::Error), + #[error(transparent)] + RuleSets_ListByProfile(#[from] rule_sets::list_by_profile::Error), + #[error(transparent)] + RuleSets_Get(#[from] rule_sets::get::Error), + #[error(transparent)] + RuleSets_Create(#[from] rule_sets::create::Error), + #[error(transparent)] + RuleSets_Delete(#[from] rule_sets::delete::Error), + #[error(transparent)] + RuleSets_ListResourceUsage(#[from] rule_sets::list_resource_usage::Error), + #[error(transparent)] + Rules_ListByRuleSet(#[from] rules::list_by_rule_set::Error), + #[error(transparent)] + Rules_Get(#[from] rules::get::Error), + #[error(transparent)] + Rules_Create(#[from] rules::create::Error), + #[error(transparent)] + Rules_Update(#[from] rules::update::Error), + #[error(transparent)] + Rules_Delete(#[from] rules::delete::Error), + #[error(transparent)] + SecurityPolicies_ListByProfile(#[from] security_policies::list_by_profile::Error), + #[error(transparent)] + SecurityPolicies_Get(#[from] security_policies::get::Error), + #[error(transparent)] + SecurityPolicies_Create(#[from] security_policies::create::Error), + #[error(transparent)] + SecurityPolicies_Patch(#[from] security_policies::patch::Error), + #[error(transparent)] + SecurityPolicies_Delete(#[from] security_policies::delete::Error), + #[error(transparent)] + Secrets_ListByProfile(#[from] secrets::list_by_profile::Error), + #[error(transparent)] + Secrets_Get(#[from] secrets::get::Error), + #[error(transparent)] + Secrets_Create(#[from] secrets::create::Error), + #[error(transparent)] + Secrets_Delete(#[from] secrets::delete::Error), + #[error(transparent)] + Validate_Secret(#[from] validate::secret::Error), + #[error(transparent)] + LogAnalytics_GetLogAnalyticsMetrics(#[from] log_analytics::get_log_analytics_metrics::Error), + #[error(transparent)] + LogAnalytics_GetLogAnalyticsRankings(#[from] log_analytics::get_log_analytics_rankings::Error), + #[error(transparent)] + LogAnalytics_GetLogAnalyticsLocations(#[from] log_analytics::get_log_analytics_locations::Error), + #[error(transparent)] + LogAnalytics_GetLogAnalyticsResources(#[from] log_analytics::get_log_analytics_resources::Error), + #[error(transparent)] + LogAnalytics_GetWafLogAnalyticsMetrics(#[from] log_analytics::get_waf_log_analytics_metrics::Error), + #[error(transparent)] + LogAnalytics_GetWafLogAnalyticsRankings(#[from] log_analytics::get_waf_log_analytics_rankings::Error), + #[error(transparent)] + Profiles_List(#[from] profiles::list::Error), + #[error(transparent)] + Profiles_ListByResourceGroup(#[from] profiles::list_by_resource_group::Error), + #[error(transparent)] + Profiles_Get(#[from] profiles::get::Error), + #[error(transparent)] + Profiles_Create(#[from] profiles::create::Error), + #[error(transparent)] + Profiles_Update(#[from] profiles::update::Error), + #[error(transparent)] + Profiles_Delete(#[from] profiles::delete::Error), + #[error(transparent)] + Profiles_GenerateSsoUri(#[from] profiles::generate_sso_uri::Error), + #[error(transparent)] + Profiles_ListSupportedOptimizationTypes(#[from] profiles::list_supported_optimization_types::Error), + #[error(transparent)] + Profiles_ListResourceUsage(#[from] profiles::list_resource_usage::Error), + #[error(transparent)] + Endpoints_ListByProfile(#[from] endpoints::list_by_profile::Error), + #[error(transparent)] + Endpoints_Get(#[from] endpoints::get::Error), + #[error(transparent)] + Endpoints_Create(#[from] endpoints::create::Error), + #[error(transparent)] + Endpoints_Update(#[from] endpoints::update::Error), + #[error(transparent)] + Endpoints_Delete(#[from] endpoints::delete::Error), + #[error(transparent)] + Endpoints_Start(#[from] endpoints::start::Error), + #[error(transparent)] + Endpoints_Stop(#[from] endpoints::stop::Error), + #[error(transparent)] + Endpoints_PurgeContent(#[from] endpoints::purge_content::Error), + #[error(transparent)] + Endpoints_LoadContent(#[from] endpoints::load_content::Error), + #[error(transparent)] + Endpoints_ValidateCustomDomain(#[from] endpoints::validate_custom_domain::Error), + #[error(transparent)] + Endpoints_ListResourceUsage(#[from] endpoints::list_resource_usage::Error), + #[error(transparent)] + Origins_ListByEndpoint(#[from] origins::list_by_endpoint::Error), + #[error(transparent)] + Origins_Get(#[from] origins::get::Error), + #[error(transparent)] + Origins_Create(#[from] origins::create::Error), + #[error(transparent)] + Origins_Update(#[from] origins::update::Error), + #[error(transparent)] + Origins_Delete(#[from] origins::delete::Error), + #[error(transparent)] + OriginGroups_ListByEndpoint(#[from] origin_groups::list_by_endpoint::Error), + #[error(transparent)] + OriginGroups_Get(#[from] origin_groups::get::Error), + #[error(transparent)] + OriginGroups_Create(#[from] origin_groups::create::Error), + #[error(transparent)] + OriginGroups_Update(#[from] origin_groups::update::Error), + #[error(transparent)] + OriginGroups_Delete(#[from] origin_groups::delete::Error), + #[error(transparent)] + CustomDomains_ListByEndpoint(#[from] custom_domains::list_by_endpoint::Error), + #[error(transparent)] + CustomDomains_Get(#[from] custom_domains::get::Error), + #[error(transparent)] + CustomDomains_Create(#[from] custom_domains::create::Error), + #[error(transparent)] + CustomDomains_Delete(#[from] custom_domains::delete::Error), + #[error(transparent)] + CustomDomains_DisableCustomHttps(#[from] custom_domains::disable_custom_https::Error), + #[error(transparent)] + CustomDomains_EnableCustomHttps(#[from] custom_domains::enable_custom_https::Error), + #[error(transparent)] + CheckNameAvailability(#[from] check_name_availability::Error), + #[error(transparent)] + CheckNameAvailabilityWithSubscription(#[from] check_name_availability_with_subscription::Error), + #[error(transparent)] + ValidateProbe(#[from] validate_probe::Error), + #[error(transparent)] + ResourceUsage_List(#[from] resource_usage::list::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + EdgeNodes_List(#[from] edge_nodes::list::Error), + #[error(transparent)] + Policies_List(#[from] policies::list::Error), + #[error(transparent)] + Policies_Get(#[from] policies::get::Error), + #[error(transparent)] + Policies_CreateOrUpdate(#[from] policies::create_or_update::Error), + #[error(transparent)] + Policies_Update(#[from] policies::update::Error), + #[error(transparent)] + Policies_Delete(#[from] policies::delete::Error), + #[error(transparent)] + ManagedRuleSets_List(#[from] managed_rule_sets::list::Error), +} +pub mod afd_profiles { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_resource_usage( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_resource_usage::Builder { + list_resource_usage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_host_name_availability( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + check_host_name_availability_input: impl Into, + subscription_id: impl Into, + ) -> check_host_name_availability::Builder { + check_host_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + check_host_name_availability_input: check_host_name_availability_input.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_resource_usage { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UsagesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_host_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) check_host_name_availability_input: models::CheckHostNameAvailabilityInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/checkHostNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.check_host_name_availability_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod afd_custom_domains { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_profile( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_by_profile::Builder { + list_by_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + custom_domain_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + custom_domain_name: custom_domain_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + custom_domain_name: impl Into, + custom_domain: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + custom_domain_name: custom_domain_name.into(), + custom_domain: custom_domain.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + custom_domain_name: impl Into, + custom_domain_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + custom_domain_name: custom_domain_name.into(), + custom_domain_update_properties: custom_domain_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + custom_domain_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + custom_domain_name: custom_domain_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_validation_token( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + custom_domain_name: impl Into, + subscription_id: impl Into, + ) -> refresh_validation_token::Builder { + refresh_validation_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + custom_domain_name: custom_domain_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/customDomains", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdDomainListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) custom_domain_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/customDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.custom_domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AfdDomain), + Created201(models::AfdDomain), + Accepted202(models::AfdDomain), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) custom_domain_name: String, + pub(crate) custom_domain: models::AfdDomain, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/customDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.custom_domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.custom_domain).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AfdDomain), + Accepted202(models::AfdDomain), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) custom_domain_name: String, + pub(crate) custom_domain_update_properties: models::AfdDomainUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/customDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.custom_domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.custom_domain_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) custom_domain_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/customDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.custom_domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod refresh_validation_token { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) custom_domain_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/customDomains/{}/refreshValidationToken", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.custom_domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod afd_endpoints { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_profile( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_by_profile::Builder { + list_by_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + endpoint: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + endpoint: endpoint.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + endpoint_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + endpoint_update_properties: endpoint_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn purge_content( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + contents: impl Into, + subscription_id: impl Into, + ) -> purge_content::Builder { + purge_content::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + contents: contents.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_resource_usage( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> list_resource_usage::Builder { + list_resource_usage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn validate_custom_domain( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + custom_domain_properties: impl Into, + subscription_id: impl Into, + ) -> validate_custom_domain::Builder { + validate_custom_domain::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + custom_domain_properties: custom_domain_properties.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdEndpointListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AfdEndpoint), + Created201(models::AfdEndpoint), + Accepted202(models::AfdEndpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) endpoint: models::AfdEndpoint, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.endpoint).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AfdEndpoint), + Accepted202(models::AfdEndpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) endpoint_update_properties: models::AfdEndpointUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.endpoint_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod purge_content { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) contents: models::AfdPurgeParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}/purge", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.contents).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_resource_usage { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UsagesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_custom_domain { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) custom_domain_properties: models::ValidateCustomDomainInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}/validateCustomDomain", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.custom_domain_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateCustomDomainOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod afd_origin_groups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_profile( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_by_profile::Builder { + list_by_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + origin_group: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + origin_group: origin_group.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + origin_group_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + origin_group_update_properties: origin_group_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_resource_usage( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + subscription_id: impl Into, + ) -> list_resource_usage::Builder { + list_resource_usage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOriginGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AfdOriginGroup), + Created201(models::AfdOriginGroup), + Accepted202(models::AfdOriginGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) origin_group: models::AfdOriginGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.origin_group).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AfdOriginGroup), + Accepted202(models::AfdOriginGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) origin_group_update_properties: models::AfdOriginGroupUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.origin_group_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_resource_usage { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UsagesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod afd_origins { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_origin_group( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_origin_group::Builder { + list_by_origin_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + origin_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + origin_name: origin_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + origin_name: impl Into, + origin: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + origin_name: origin_name.into(), + origin: origin.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + origin_name: impl Into, + origin_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + origin_name: origin_name.into(), + origin_update_properties: origin_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + origin_group_name: impl Into, + origin_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + origin_group_name: origin_group_name.into(), + origin_name: origin_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_origin_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}/origins", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOriginListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) origin_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}/origins/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name, + &self.origin_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOrigin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AfdOrigin), + Created201(models::AfdOrigin), + Accepted202(models::AfdOrigin), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) origin_name: String, + pub(crate) origin: models::AfdOrigin, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}/origins/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name, + &self.origin_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.origin).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOrigin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOrigin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOrigin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AfdOrigin), + Accepted202(models::AfdOrigin), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) origin_name: String, + pub(crate) origin_update_properties: models::AfdOriginUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}/origins/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name, + &self.origin_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.origin_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOrigin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdOrigin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) origin_group_name: String, + pub(crate) origin_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/originGroups/{}/origins/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.origin_group_name, + &self.origin_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod routes { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_endpoint( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> list_by_endpoint::Builder { + list_by_endpoint::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + route_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + route_name: route_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + route_name: impl Into, + route: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + route_name: route_name.into(), + route: route.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + route_name: impl Into, + route_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + route_name: route_name.into(), + route_update_properties: route_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + route_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + route_name: route_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_endpoint { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}/routes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) route_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}/routes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.route_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Route), + Created201(models::Route), + Accepted202(models::Route), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) route_name: String, + pub(crate) route: models::Route, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}/routes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.route_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.route).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Route), + Accepted202(models::Route), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) route_name: String, + pub(crate) route_update_properties: models::RouteUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}/routes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.route_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.route_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) route_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/afdEndpoints/{}/routes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.route_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod rule_sets { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_profile( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_by_profile::Builder { + list_by_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_resource_usage( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + subscription_id: impl Into, + ) -> list_resource_usage::Builder { + list_resource_usage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RuleSetListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RuleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RuleSet), + Created201(models::RuleSet), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RuleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RuleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_resource_usage { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UsagesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod rules { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_rule_set( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + subscription_id: impl Into, + ) -> list_by_rule_set::Builder { + list_by_rule_set::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + rule_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + rule_name: rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + rule_name: impl Into, + rule: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + rule_name: rule_name.into(), + rule: rule.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + rule_name: impl Into, + rule_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + rule_name: rule_name.into(), + rule_update_properties: rule_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + rule_set_name: impl Into, + rule_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rule_set_name: rule_set_name.into(), + rule_name: rule_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_rule_set { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}/rules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}/rules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Rule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Rule), + Created201(models::Rule), + Accepted202(models::Rule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) rule_name: String, + pub(crate) rule: models::Rule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}/rules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.rule).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Rule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Rule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Rule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Rule), + Accepted202(models::Rule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) rule_name: String, + pub(crate) rule_update_properties: models::RuleUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}/rules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.rule_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Rule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Rule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rule_set_name: String, + pub(crate) rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/ruleSets/{}/rules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.rule_set_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod security_policies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_profile( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_by_profile::Builder { + list_by_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + security_policy_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + security_policy_name: security_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + security_policy_name: impl Into, + security_policy: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + security_policy_name: security_policy_name.into(), + security_policy: security_policy.into(), + subscription_id: subscription_id.into(), + } + } + pub fn patch( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + security_policy_name: impl Into, + security_policy_properties: impl Into, + subscription_id: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + security_policy_name: security_policy_name.into(), + security_policy_properties: security_policy_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + security_policy_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + security_policy_name: security_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/securityPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPolicyListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) security_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/securityPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.security_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::SecurityPolicy), + Created201(models::SecurityPolicy), + Accepted202(models::SecurityPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) security_policy_name: String, + pub(crate) security_policy: models::SecurityPolicy, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/securityPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.security_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.security_policy).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::SecurityPolicy), + Accepted202(models::SecurityPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) security_policy_name: String, + pub(crate) security_policy_properties: models::SecurityPolicyProperties, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/securityPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.security_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.security_policy_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) security_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/securityPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.security_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod secrets { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_profile( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_by_profile::Builder { + list_by_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + secret_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + secret_name: secret_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + secret_name: impl Into, + secret: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + secret_name: secret_name.into(), + secret: secret.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + secret_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + secret_name: secret_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/secrets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecretListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) secret_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/secrets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.secret_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Secret = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Secret), + Created201(models::Secret), + Accepted202(models::Secret), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) secret_name: String, + pub(crate) secret: models::Secret, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/secrets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.secret_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.secret).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Secret = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Secret = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Secret = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) secret_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/secrets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.secret_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod validate { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn secret( + &self, + validate_secret_input: impl Into, + subscription_id: impl Into, + ) -> secret::Builder { + secret::Builder { + client: self.0.clone(), + validate_secret_input: validate_secret_input.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod secret { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) validate_secret_input: models::ValidateSecretInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Cdn/validateSecret", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.validate_secret_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateSecretOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod log_analytics { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_log_analytics_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + profile_name: impl Into, + metrics: Vec, + date_time_begin: impl Into, + date_time_end: impl Into, + granularity: impl Into, + custom_domains: Vec, + protocols: Vec, + ) -> get_log_analytics_metrics::Builder { + get_log_analytics_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + metrics, + date_time_begin: date_time_begin.into(), + date_time_end: date_time_end.into(), + granularity: granularity.into(), + custom_domains, + protocols, + group_by: Vec::new(), + continents: Vec::new(), + country_or_regions: Vec::new(), + } + } + pub fn get_log_analytics_rankings( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + profile_name: impl Into, + rankings: Vec, + metrics: Vec, + max_ranking: i32, + date_time_begin: impl Into, + date_time_end: impl Into, + ) -> get_log_analytics_rankings::Builder { + get_log_analytics_rankings::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + rankings, + metrics, + max_ranking, + date_time_begin: date_time_begin.into(), + date_time_end: date_time_end.into(), + custom_domains: Vec::new(), + } + } + pub fn get_log_analytics_locations( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + profile_name: impl Into, + ) -> get_log_analytics_locations::Builder { + get_log_analytics_locations::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + } + } + pub fn get_log_analytics_resources( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + profile_name: impl Into, + ) -> get_log_analytics_resources::Builder { + get_log_analytics_resources::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + } + } + pub fn get_waf_log_analytics_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + profile_name: impl Into, + metrics: Vec, + date_time_begin: impl Into, + date_time_end: impl Into, + granularity: impl Into, + ) -> get_waf_log_analytics_metrics::Builder { + get_waf_log_analytics_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + metrics, + date_time_begin: date_time_begin.into(), + date_time_end: date_time_end.into(), + granularity: granularity.into(), + actions: Vec::new(), + group_by: Vec::new(), + rule_types: Vec::new(), + } + } + pub fn get_waf_log_analytics_rankings( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + profile_name: impl Into, + metrics: Vec, + date_time_begin: impl Into, + date_time_end: impl Into, + max_ranking: i32, + rankings: Vec, + ) -> get_waf_log_analytics_rankings::Builder { + get_waf_log_analytics_rankings::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + metrics, + date_time_begin: date_time_begin.into(), + date_time_end: date_time_end.into(), + max_ranking, + rankings, + actions: Vec::new(), + rule_types: Vec::new(), + } + } + } + pub mod get_log_analytics_metrics { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) metrics: Vec, + pub(crate) date_time_begin: String, + pub(crate) date_time_end: String, + pub(crate) granularity: String, + pub(crate) custom_domains: Vec, + pub(crate) protocols: Vec, + pub(crate) group_by: Vec, + pub(crate) continents: Vec, + pub(crate) country_or_regions: Vec, + } + impl Builder { + pub fn group_by(mut self, group_by: Vec) -> Self { + self.group_by = group_by; + self + } + pub fn continents(mut self, continents: Vec) -> Self { + self.continents = continents; + self + } + pub fn country_or_regions(mut self, country_or_regions: Vec) -> Self { + self.country_or_regions = country_or_regions; + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/getLogAnalyticsMetrics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let metrics = &self.metrics; + for value in &self.metrics { + url.query_pairs_mut().append_pair("metrics", &value.to_string()); + } + let date_time_begin = &self.date_time_begin; + url.query_pairs_mut().append_pair("dateTimeBegin", date_time_begin); + let date_time_end = &self.date_time_end; + url.query_pairs_mut().append_pair("dateTimeEnd", date_time_end); + let granularity = &self.granularity; + url.query_pairs_mut().append_pair("granularity", granularity); + let group_by = &self.group_by; + for value in &self.group_by { + url.query_pairs_mut().append_pair("groupBy", &value.to_string()); + } + let continents = &self.continents; + for value in &self.continents { + url.query_pairs_mut().append_pair("continents", &value.to_string()); + } + let country_or_regions = &self.country_or_regions; + for value in &self.country_or_regions { + url.query_pairs_mut().append_pair("countryOrRegions", &value.to_string()); + } + let custom_domains = &self.custom_domains; + for value in &self.custom_domains { + url.query_pairs_mut().append_pair("customDomains", &value.to_string()); + } + let protocols = &self.protocols; + for value in &self.protocols { + url.query_pairs_mut().append_pair("protocols", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_log_analytics_rankings { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) rankings: Vec, + pub(crate) metrics: Vec, + pub(crate) max_ranking: i32, + pub(crate) date_time_begin: String, + pub(crate) date_time_end: String, + pub(crate) custom_domains: Vec, + } + impl Builder { + pub fn custom_domains(mut self, custom_domains: Vec) -> Self { + self.custom_domains = custom_domains; + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/getLogAnalyticsRankings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let rankings = &self.rankings; + for value in &self.rankings { + url.query_pairs_mut().append_pair("rankings", &value.to_string()); + } + let metrics = &self.metrics; + for value in &self.metrics { + url.query_pairs_mut().append_pair("metrics", &value.to_string()); + } + let max_ranking = &self.max_ranking; + url.query_pairs_mut().append_pair("maxRanking", &max_ranking.to_string()); + let date_time_begin = &self.date_time_begin; + url.query_pairs_mut().append_pair("dateTimeBegin", date_time_begin); + let date_time_end = &self.date_time_end; + url.query_pairs_mut().append_pair("dateTimeEnd", date_time_end); + let custom_domains = &self.custom_domains; + for value in &self.custom_domains { + url.query_pairs_mut().append_pair("customDomains", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RankingsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_log_analytics_locations { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/getLogAnalyticsLocations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContinentsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_log_analytics_resources { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/getLogAnalyticsResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourcesResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_waf_log_analytics_metrics { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) metrics: Vec, + pub(crate) date_time_begin: String, + pub(crate) date_time_end: String, + pub(crate) granularity: String, + pub(crate) actions: Vec, + pub(crate) group_by: Vec, + pub(crate) rule_types: Vec, + } + impl Builder { + pub fn actions(mut self, actions: Vec) -> Self { + self.actions = actions; + self + } + pub fn group_by(mut self, group_by: Vec) -> Self { + self.group_by = group_by; + self + } + pub fn rule_types(mut self, rule_types: Vec) -> Self { + self.rule_types = rule_types; + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/getWafLogAnalyticsMetrics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let metrics = &self.metrics; + for value in &self.metrics { + url.query_pairs_mut().append_pair("metrics", &value.to_string()); + } + let date_time_begin = &self.date_time_begin; + url.query_pairs_mut().append_pair("dateTimeBegin", date_time_begin); + let date_time_end = &self.date_time_end; + url.query_pairs_mut().append_pair("dateTimeEnd", date_time_end); + let granularity = &self.granularity; + url.query_pairs_mut().append_pair("granularity", granularity); + let actions = &self.actions; + for value in &self.actions { + url.query_pairs_mut().append_pair("actions", &value.to_string()); + } + let group_by = &self.group_by; + for value in &self.group_by { + url.query_pairs_mut().append_pair("groupBy", &value.to_string()); + } + let rule_types = &self.rule_types; + for value in &self.rule_types { + url.query_pairs_mut().append_pair("ruleTypes", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WafMetricsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_waf_log_analytics_rankings { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AfdErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) metrics: Vec, + pub(crate) date_time_begin: String, + pub(crate) date_time_end: String, + pub(crate) max_ranking: i32, + pub(crate) rankings: Vec, + pub(crate) actions: Vec, + pub(crate) rule_types: Vec, + } + impl Builder { + pub fn actions(mut self, actions: Vec) -> Self { + self.actions = actions; + self + } + pub fn rule_types(mut self, rule_types: Vec) -> Self { + self.rule_types = rule_types; + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/getWafLogAnalyticsRankings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let metrics = &self.metrics; + for value in &self.metrics { + url.query_pairs_mut().append_pair("metrics", &value.to_string()); + } + let date_time_begin = &self.date_time_begin; + url.query_pairs_mut().append_pair("dateTimeBegin", date_time_begin); + let date_time_end = &self.date_time_end; + url.query_pairs_mut().append_pair("dateTimeEnd", date_time_end); + let max_ranking = &self.max_ranking; + url.query_pairs_mut().append_pair("maxRanking", &max_ranking.to_string()); + let rankings = &self.rankings; + for value in &self.rankings { + url.query_pairs_mut().append_pair("rankings", &value.to_string()); + } + let actions = &self.actions; + for value in &self.actions { + url.query_pairs_mut().append_pair("actions", &value.to_string()); + } + let rule_types = &self.rule_types; + for value in &self.rule_types { + url.query_pairs_mut().append_pair("ruleTypes", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WafRankingsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AfdErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod profiles { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + profile: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + profile: profile.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + profile_update_parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + profile_update_parameters: profile_update_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_sso_uri( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> generate_sso_uri::Builder { + generate_sso_uri::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_supported_optimization_types( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_supported_optimization_types::Builder { + list_supported_optimization_types::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_resource_usage( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_resource_usage::Builder { + list_resource_usage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Cdn/profiles", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Profile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Profile), + Created201(models::Profile), + Accepted202(models::Profile), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) profile: models::Profile, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.profile).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Profile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Profile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Profile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Profile), + Accepted202(models::Profile), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) profile_update_parameters: models::ProfileUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.profile_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Profile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Profile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_sso_uri { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/generateSsoUri", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SsoUri = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_supported_optimization_types { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/getSupportedOptimizationTypes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SupportedOptimizationTypesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_resource_usage { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/checkResourceUsage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceUsageListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod endpoints { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_profile( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + subscription_id: impl Into, + ) -> list_by_profile::Builder { + list_by_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + endpoint: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + endpoint: endpoint.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + endpoint_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + endpoint_update_properties: endpoint_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn stop( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn purge_content( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + content_file_paths: impl Into, + subscription_id: impl Into, + ) -> purge_content::Builder { + purge_content::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + content_file_paths: content_file_paths.into(), + subscription_id: subscription_id.into(), + } + } + pub fn load_content( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + content_file_paths: impl Into, + subscription_id: impl Into, + ) -> load_content::Builder { + load_content::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + content_file_paths: content_file_paths.into(), + subscription_id: subscription_id.into(), + } + } + pub fn validate_custom_domain( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + custom_domain_properties: impl Into, + subscription_id: impl Into, + ) -> validate_custom_domain::Builder { + validate_custom_domain::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + custom_domain_properties: custom_domain_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_resource_usage( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> list_resource_usage::Builder { + list_resource_usage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EndpointListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Endpoint), + Created201(models::Endpoint), + Accepted202(models::Endpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) endpoint: models::Endpoint, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.endpoint).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Endpoint), + Accepted202(models::Endpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) endpoint_update_properties: models::EndpointUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.endpoint_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Endpoint), + Accepted202(models::Endpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Endpoint), + Accepted202(models::Endpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Endpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod purge_content { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) content_file_paths: models::PurgeParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/purge", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.content_file_paths).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod load_content { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) content_file_paths: models::LoadParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/load", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.content_file_paths).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_custom_domain { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) custom_domain_properties: models::ValidateCustomDomainInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/validateCustomDomain", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.custom_domain_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateCustomDomainOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_resource_usage { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/checkResourceUsage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceUsageListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod origins { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_endpoint( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> list_by_endpoint::Builder { + list_by_endpoint::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + origin_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + origin_name: origin_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + origin_name: impl Into, + origin: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + origin_name: origin_name.into(), + origin: origin.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + origin_name: impl Into, + origin_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + origin_name: origin_name.into(), + origin_update_properties: origin_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + origin_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + origin_name: origin_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_endpoint { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/origins", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OriginListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) origin_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/origins/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.origin_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Origin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Origin), + Created201(models::Origin), + Accepted202(models::Origin), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) origin_name: String, + pub(crate) origin: models::Origin, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/origins/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.origin_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.origin).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Origin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Origin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Origin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Origin), + Accepted202(models::Origin), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) origin_name: String, + pub(crate) origin_update_properties: models::OriginUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/origins/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.origin_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.origin_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Origin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Origin = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) origin_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/origins/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.origin_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod origin_groups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_endpoint( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> list_by_endpoint::Builder { + list_by_endpoint::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + origin_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + origin_group_name: origin_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + origin_group_name: impl Into, + origin_group: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + origin_group_name: origin_group_name.into(), + origin_group: origin_group.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + origin_group_name: impl Into, + origin_group_update_properties: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + origin_group_name: origin_group_name.into(), + origin_group_update_properties: origin_group_update_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + origin_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + origin_group_name: origin_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_endpoint { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/originGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OriginGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) origin_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/originGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OriginGroup), + Created201(models::OriginGroup), + Accepted202(models::OriginGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) origin_group_name: String, + pub(crate) origin_group: models::OriginGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/originGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.origin_group).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OriginGroup), + Accepted202(models::OriginGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) origin_group_name: String, + pub(crate) origin_group_update_properties: models::OriginGroupUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/originGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.origin_group_update_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OriginGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) origin_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/originGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.origin_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod custom_domains { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_endpoint( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + subscription_id: impl Into, + ) -> list_by_endpoint::Builder { + list_by_endpoint::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + custom_domain_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + custom_domain_name: custom_domain_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + custom_domain_name: impl Into, + custom_domain_properties: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + custom_domain_name: custom_domain_name.into(), + custom_domain_properties: custom_domain_properties.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + custom_domain_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + custom_domain_name: custom_domain_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn disable_custom_https( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + custom_domain_name: impl Into, + subscription_id: impl Into, + ) -> disable_custom_https::Builder { + disable_custom_https::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + custom_domain_name: custom_domain_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn enable_custom_https( + &self, + resource_group_name: impl Into, + profile_name: impl Into, + endpoint_name: impl Into, + custom_domain_name: impl Into, + subscription_id: impl Into, + ) -> enable_custom_https::Builder { + enable_custom_https::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + profile_name: profile_name.into(), + endpoint_name: endpoint_name.into(), + custom_domain_name: custom_domain_name.into(), + subscription_id: subscription_id.into(), + custom_domain_https_parameters: None, + } + } + } + pub mod list_by_endpoint { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/customDomains", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomainListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) custom_domain_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/customDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.custom_domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CustomDomain), + Created201(models::CustomDomain), + Accepted202(models::CustomDomain), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) custom_domain_name: String, + pub(crate) custom_domain_properties: models::CustomDomainParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/customDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.custom_domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.custom_domain_properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::CustomDomain), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) custom_domain_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/customDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.profile_name, + &self.endpoint_name, + &self.custom_domain_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod disable_custom_https { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::CustomDomain), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) custom_domain_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/customDomains/{}/disableCustomHttps" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . profile_name , & self . endpoint_name , & self . custom_domain_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod enable_custom_https { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::CustomDomain), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) profile_name: String, + pub(crate) endpoint_name: String, + pub(crate) custom_domain_name: String, + pub(crate) subscription_id: String, + pub(crate) custom_domain_https_parameters: Option, + } + impl Builder { + pub fn custom_domain_https_parameters( + mut self, + custom_domain_https_parameters: impl Into, + ) -> Self { + self.custom_domain_https_parameters = Some(custom_domain_https_parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/profiles/{}/endpoints/{}/customDomains/{}/enableCustomHttps" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . profile_name , & self . endpoint_name , & self . custom_domain_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(custom_domain_https_parameters) = &self.custom_domain_https_parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(custom_domain_https_parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn check_name_availability( + &self, + check_name_availability_input: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.clone(), + check_name_availability_input: check_name_availability_input.into(), + } + } + pub fn check_name_availability_with_subscription( + &self, + check_name_availability_input: impl Into, + subscription_id: impl Into, + ) -> check_name_availability_with_subscription::Builder { + check_name_availability_with_subscription::Builder { + client: self.clone(), + check_name_availability_input: check_name_availability_input.into(), + subscription_id: subscription_id.into(), + } + } + pub fn validate_probe( + &self, + validate_probe_input: impl Into, + subscription_id: impl Into, + ) -> validate_probe::Builder { + validate_probe::Builder { + client: self.clone(), + validate_probe_input: validate_probe_input.into(), + subscription_id: subscription_id.into(), + } + } +} +pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) check_name_availability_input: models::CheckNameAvailabilityInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Cdn/checkNameAvailability", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.check_name_availability_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod check_name_availability_with_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) check_name_availability_input: models::CheckNameAvailabilityInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Cdn/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.check_name_availability_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod validate_probe { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) validate_probe_input: models::ValidateProbeInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Cdn/validateProbe", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.validate_probe_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateProbeOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod resource_usage { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Cdn/checkResourceUsage", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceUsageListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Cdn/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod edge_nodes { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Cdn/edgenodes", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EdgenodeResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + policy_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + policy_name: policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + policy_name: impl Into, + subscription_id: impl Into, + cdn_web_application_firewall_policy: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + policy_name: policy_name.into(), + subscription_id: subscription_id.into(), + cdn_web_application_firewall_policy: cdn_web_application_firewall_policy.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + policy_name: impl Into, + subscription_id: impl Into, + cdn_web_application_firewall_policy_patch_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + policy_name: policy_name.into(), + subscription_id: subscription_id.into(), + cdn_web_application_firewall_policy_patch_parameters: cdn_web_application_firewall_policy_patch_parameters.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + policy_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + policy_name: policy_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CdnWebApplicationFirewallPolicyList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CdnWebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CdnWebApplicationFirewallPolicy), + Created201(models::CdnWebApplicationFirewallPolicy), + Accepted202(models::CdnWebApplicationFirewallPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) policy_name: String, + pub(crate) subscription_id: String, + pub(crate) cdn_web_application_firewall_policy: models::CdnWebApplicationFirewallPolicy, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.cdn_web_application_firewall_policy).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CdnWebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CdnWebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CdnWebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CdnWebApplicationFirewallPolicy), + Accepted202(models::CdnWebApplicationFirewallPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) policy_name: String, + pub(crate) subscription_id: String, + pub(crate) cdn_web_application_firewall_policy_patch_parameters: models::CdnWebApplicationFirewallPolicyPatchParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = + azure_core::to_json(&self.cdn_web_application_firewall_policy_patch_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CdnWebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CdnWebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_rule_sets { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedRuleSetDefinitionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/compute/Cargo.toml b/services/mgmt/compute/Cargo.toml index d99442e9b3..28286417e2 100644 --- a/services/mgmt/compute/Cargo.toml +++ b/services/mgmt/compute/Cargo.toml @@ -19,10 +19,11 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2021-07-01", "enable_reqwest"] +default = ["package-2021-08-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-08-01" = [] "package-2021-07-01" = [] "package-2021-07-01-only" = [] "package-2021-06-01-preview" = [] diff --git a/services/mgmt/compute/src/lib.rs b/services/mgmt/compute/src/lib.rs index 4cdecf6d82..56d168a05b 100644 --- a/services/mgmt/compute/src/lib.rs +++ b/services/mgmt/compute/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-08-01")] +pub mod package_2021_08_01; +#[cfg(all(feature = "package-2021-08-01", not(feature = "no-default-version")))] +pub use package_2021_08_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-07-01")] pub mod package_2021_07_01; #[cfg(all(feature = "package-2021-07-01", not(feature = "no-default-version")))] diff --git a/services/mgmt/compute/src/package_2021_08_01/mod.rs b/services/mgmt/compute/src/package_2021_08_01/mod.rs new file mode 100644 index 0000000000..fdc89d4415 --- /dev/null +++ b/services/mgmt/compute/src/package_2021_08_01/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-08-01"; diff --git a/services/mgmt/compute/src/package_2021_08_01/models.rs b/services/mgmt/compute/src/package_2021_08_01/models.rs new file mode 100644 index 0000000000..1b8ab7e9c2 --- /dev/null +++ b/services/mgmt/compute/src/package_2021_08_01/models.rs @@ -0,0 +1,5708 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccessUri { + #[serde(rename = "accessSAS", default, skip_serializing_if = "Option::is_none")] + pub access_sas: Option, + #[serde(rename = "securityDataAccessSAS", default, skip_serializing_if = "Option::is_none")] + pub security_data_access_sas: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdditionalCapabilities { + #[serde(rename = "ultraSSDEnabled", default, skip_serializing_if = "Option::is_none")] + pub ultra_ssd_enabled: Option, + #[serde(rename = "hibernationEnabled", default, skip_serializing_if = "Option::is_none")] + pub hibernation_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdditionalUnattendContent { + #[serde(rename = "passName", default, skip_serializing_if = "Option::is_none")] + pub pass_name: Option, + #[serde(rename = "componentName", default, skip_serializing_if = "Option::is_none")] + pub component_name: Option, + #[serde(rename = "settingName", default, skip_serializing_if = "Option::is_none")] + pub setting_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, +} +pub mod additional_unattend_content { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PassName { + OobeSystem, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComponentName { + #[serde(rename = "Microsoft-Windows-Shell-Setup")] + MicrosoftWindowsShellSetup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SettingName { + AutoLogon, + FirstLogonCommands, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiEntityReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiError { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub innererror: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiErrorBase { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationProfile { + #[serde(rename = "galleryApplications", default, skip_serializing_if = "Vec::is_empty")] + pub gallery_applications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomaticOsUpgradePolicy { + #[serde(rename = "enableAutomaticOSUpgrade", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_os_upgrade: Option, + #[serde(rename = "disableAutomaticRollback", default, skip_serializing_if = "Option::is_none")] + pub disable_automatic_rollback: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomaticOsUpgradeProperties { + #[serde(rename = "automaticOSUpgradeSupported")] + pub automatic_os_upgrade_supported: bool, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomaticRepairsPolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "gracePeriod", default, skip_serializing_if = "Option::is_none")] + pub grace_period: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailabilitySet { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailabilitySetListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailabilitySetProperties { + #[serde(rename = "platformUpdateDomainCount", default, skip_serializing_if = "Option::is_none")] + pub platform_update_domain_count: Option, + #[serde(rename = "platformFaultDomainCount", default, skip_serializing_if = "Option::is_none")] + pub platform_fault_domain_count: Option, + #[serde(rename = "virtualMachines", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_machines: Vec, + #[serde(rename = "proximityPlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AvailabilitySetSkuType { + Classic, + Aligned, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailabilitySetUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailablePatchSummary { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "assessmentActivityId", default, skip_serializing_if = "Option::is_none")] + pub assessment_activity_id: Option, + #[serde(rename = "rebootPending", default, skip_serializing_if = "Option::is_none")] + pub reboot_pending: Option, + #[serde(rename = "criticalAndSecurityPatchCount", default, skip_serializing_if = "Option::is_none")] + pub critical_and_security_patch_count: Option, + #[serde(rename = "otherPatchCount", default, skip_serializing_if = "Option::is_none")] + pub other_patch_count: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "lastModifiedTime", default, skip_serializing_if = "Option::is_none")] + pub last_modified_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod available_patch_summary { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Unknown, + InProgress, + Failed, + Succeeded, + CompletedWithWarnings, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BillingProfile { + #[serde(rename = "maxPrice", default, skip_serializing_if = "Option::is_none")] + pub max_price: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BootDiagnostics { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BootDiagnosticsInstanceView { + #[serde(rename = "consoleScreenshotBlobUri", default, skip_serializing_if = "Option::is_none")] + pub console_screenshot_blob_uri: Option, + #[serde(rename = "serialConsoleLogBlobUri", default, skip_serializing_if = "Option::is_none")] + pub serial_console_log_blob_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Caching { + None, + ReadOnly, + ReadWrite, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservation { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + pub sku: Sku, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationGroup { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationGroupInstanceView { + #[serde(rename = "capacityReservations", default, skip_serializing_if = "Vec::is_empty")] + pub capacity_reservations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationGroupListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationGroupProperties { + #[serde(rename = "capacityReservations", default, skip_serializing_if = "Vec::is_empty")] + pub capacity_reservations: Vec, + #[serde(rename = "virtualMachinesAssociated", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_machines_associated: Vec, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationGroupUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationInstanceView { + #[serde(rename = "utilizationInfo", default, skip_serializing_if = "Option::is_none")] + pub utilization_info: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationInstanceViewWithName { + #[serde(flatten)] + pub capacity_reservation_instance_view: CapacityReservationInstanceView, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationProfile { + #[serde(rename = "capacityReservationGroup", default, skip_serializing_if = "Option::is_none")] + pub capacity_reservation_group: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationProperties { + #[serde(rename = "reservationId", default, skip_serializing_if = "Option::is_none")] + pub reservation_id: Option, + #[serde(rename = "virtualMachinesAssociated", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_machines_associated: Vec, + #[serde(rename = "provisioningTime", default, skip_serializing_if = "Option::is_none")] + pub provisioning_time: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityReservationUtilization { + #[serde(rename = "virtualMachinesAllocated", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_machines_allocated: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudService { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceExtensionProfile { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub extensions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceExtensionProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[serde(rename = "protectedSettings", default, skip_serializing_if = "Option::is_none")] + pub protected_settings: Option, + #[serde(rename = "protectedSettingsFromKeyVault", default, skip_serializing_if = "Option::is_none")] + pub protected_settings_from_key_vault: Option, + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "rolesAppliedTo", default, skip_serializing_if = "Vec::is_empty")] + pub roles_applied_to: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceInstanceView { + #[serde(rename = "roleInstance", default, skip_serializing_if = "Option::is_none")] + pub role_instance: Option, + #[serde(rename = "sdkVersion", default, skip_serializing_if = "Option::is_none")] + pub sdk_version: Option, + #[serde(rename = "privateIds", default, skip_serializing_if = "Vec::is_empty")] + pub private_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceNetworkProfile { + #[serde(rename = "loadBalancerConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_configurations: Vec, + #[serde(rename = "swappableCloudService", default, skip_serializing_if = "Option::is_none")] + pub swappable_cloud_service: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceOsProfile { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub secrets: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceProperties { + #[serde(rename = "packageUrl", default, skip_serializing_if = "Option::is_none")] + pub package_url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub configuration: Option, + #[serde(rename = "configurationUrl", default, skip_serializing_if = "Option::is_none")] + pub configuration_url: Option, + #[serde(rename = "startCloudService", default, skip_serializing_if = "Option::is_none")] + pub start_cloud_service: Option, + #[serde(rename = "allowModelOverride", default, skip_serializing_if = "Option::is_none")] + pub allow_model_override: Option, + #[serde(rename = "upgradeMode", default, skip_serializing_if = "Option::is_none")] + pub upgrade_mode: Option, + #[serde(rename = "roleProfile", default, skip_serializing_if = "Option::is_none")] + pub role_profile: Option, + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "extensionProfile", default, skip_serializing_if = "Option::is_none")] + pub extension_profile: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "uniqueId", default, skip_serializing_if = "Option::is_none")] + pub unique_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceRole { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceRoleListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceRoleProfile { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub roles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceRoleProfileProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceRoleProperties { + #[serde(rename = "uniqueId", default, skip_serializing_if = "Option::is_none")] + pub unique_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceRoleSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum CloudServiceUpgradeMode { + Auto, + Manual, + Simultaneous, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceVaultAndSecretReference { + #[serde(rename = "sourceVault", default, skip_serializing_if = "Option::is_none")] + pub source_vault: Option, + #[serde(rename = "secretUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceVaultCertificate { + #[serde(rename = "certificateUrl", default, skip_serializing_if = "Option::is_none")] + pub certificate_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudServiceVaultSecretGroup { + #[serde(rename = "sourceVault", default, skip_serializing_if = "Option::is_none")] + pub source_vault: Option, + #[serde(rename = "vaultCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub vault_certificates: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommunityGallery { + #[serde(flatten)] + pub pir_community_gallery_resource: PirCommunityGalleryResource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommunityGalleryIdentifier { + #[serde(rename = "uniqueId", default, skip_serializing_if = "Option::is_none")] + pub unique_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommunityGalleryImage { + #[serde(flatten)] + pub pir_community_gallery_resource: PirCommunityGalleryResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommunityGalleryImageProperties { + #[serde(rename = "osType")] + pub os_type: community_gallery_image_properties::OsType, + #[serde(rename = "osState")] + pub os_state: community_gallery_image_properties::OsState, + #[serde(rename = "endOfLifeDate", default, skip_serializing_if = "Option::is_none")] + pub end_of_life_date: Option, + pub identifier: GalleryImageIdentifier, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recommended: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub disallowed: Option, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub features: Vec, + #[serde(rename = "purchasePlan", default, skip_serializing_if = "Option::is_none")] + pub purchase_plan: Option, +} +pub mod community_gallery_image_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsState { + Generalized, + Specialized, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HyperVGeneration { + V1, + V2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommunityGalleryImageVersion { + #[serde(flatten)] + pub pir_community_gallery_resource: PirCommunityGalleryResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommunityGalleryImageVersionProperties { + #[serde(rename = "publishedDate", default, skip_serializing_if = "Option::is_none")] + pub published_date: Option, + #[serde(rename = "endOfLifeDate", default, skip_serializing_if = "Option::is_none")] + pub end_of_life_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ComputeOperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ComputeOperationValue { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ComputeOperationValueDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum CreateOption { + FromImage, + Empty, + Attach, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreationData { + #[serde(rename = "createOption")] + pub create_option: creation_data::CreateOption, + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[serde(rename = "imageReference", default, skip_serializing_if = "Option::is_none")] + pub image_reference: Option, + #[serde(rename = "galleryImageReference", default, skip_serializing_if = "Option::is_none")] + pub gallery_image_reference: Option, + #[serde(rename = "sourceUri", default, skip_serializing_if = "Option::is_none")] + pub source_uri: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "sourceUniqueId", default, skip_serializing_if = "Option::is_none")] + pub source_unique_id: Option, + #[serde(rename = "uploadSizeBytes", default, skip_serializing_if = "Option::is_none")] + pub upload_size_bytes: Option, + #[serde(rename = "logicalSectorSize", default, skip_serializing_if = "Option::is_none")] + pub logical_sector_size: Option, + #[serde(rename = "securityDataUri", default, skip_serializing_if = "Option::is_none")] + pub security_data_uri: Option, +} +pub mod creation_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreateOption { + Empty, + Attach, + FromImage, + Import, + Copy, + Restore, + Upload, + CopyStart, + ImportSecure, + UploadPreparedSecure, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataDisk { + pub lun: i32, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vhd: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub image: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub caching: Option, + #[serde(rename = "writeAcceleratorEnabled", default, skip_serializing_if = "Option::is_none")] + pub write_accelerator_enabled: Option, + #[serde(rename = "createOption")] + pub create_option: CreateOption, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "managedDisk", default, skip_serializing_if = "Option::is_none")] + pub managed_disk: Option, + #[serde(rename = "toBeDetached", default, skip_serializing_if = "Option::is_none")] + pub to_be_detached: Option, + #[serde(rename = "diskIOPSReadWrite", default, skip_serializing_if = "Option::is_none")] + pub disk_iops_read_write: Option, + #[serde(rename = "diskMBpsReadWrite", default, skip_serializing_if = "Option::is_none")] + pub disk_m_bps_read_write: Option, + #[serde(rename = "detachOption", default, skip_serializing_if = "Option::is_none")] + pub detach_option: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataDiskImage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataDiskImageEncryption { + #[serde(flatten)] + pub disk_image_encryption: DiskImageEncryption, + pub lun: i32, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHost { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + pub sku: Sku, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostAllocatableVm { + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostAvailableCapacity { + #[serde(rename = "allocatableVMs", default, skip_serializing_if = "Vec::is_empty")] + pub allocatable_v_ms: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostGroup { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostGroupInstanceView { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hosts: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostGroupListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostGroupProperties { + #[serde(rename = "platformFaultDomainCount")] + pub platform_fault_domain_count: i32, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hosts: Vec, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, + #[serde(rename = "supportAutomaticPlacement", default, skip_serializing_if = "Option::is_none")] + pub support_automatic_placement: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostGroupUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostInstanceView { + #[serde(rename = "assetId", default, skip_serializing_if = "Option::is_none")] + pub asset_id: Option, + #[serde(rename = "availableCapacity", default, skip_serializing_if = "Option::is_none")] + pub available_capacity: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostInstanceViewWithName { + #[serde(flatten)] + pub dedicated_host_instance_view: DedicatedHostInstanceView, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DedicatedHostLicenseType { + None, + #[serde(rename = "Windows_Server_Hybrid")] + WindowsServerHybrid, + #[serde(rename = "Windows_Server_Perpetual")] + WindowsServerPerpetual, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostProperties { + #[serde(rename = "platformFaultDomain", default, skip_serializing_if = "Option::is_none")] + pub platform_fault_domain: Option, + #[serde(rename = "autoReplaceOnFailure", default, skip_serializing_if = "Option::is_none")] + pub auto_replace_on_failure: Option, + #[serde(rename = "hostId", default, skip_serializing_if = "Option::is_none")] + pub host_id: Option, + #[serde(rename = "virtualMachines", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_machines: Vec, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "provisioningTime", default, skip_serializing_if = "Option::is_none")] + pub provisioning_time: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DedicatedHostUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DeleteOption { + Delete, + Detach, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DetachOption { + ForceDetach, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiagnosticsProfile { + #[serde(rename = "bootDiagnostics", default, skip_serializing_if = "Option::is_none")] + pub boot_diagnostics: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DiffDiskOption { + Local, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DiffDiskPlacement { + CacheDisk, + ResourceDisk, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiffDiskSettings { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub option: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub placement: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Disallowed { + #[serde(rename = "diskTypes", default, skip_serializing_if = "Vec::is_empty")] + pub disk_types: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DisallowedConfiguration { + #[serde(rename = "vmDiskType", default, skip_serializing_if = "Option::is_none")] + pub vm_disk_type: Option, +} +pub mod disallowed_configuration { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VmDiskType { + None, + Unmanaged, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Disk { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "managedBy", default, skip_serializing_if = "Option::is_none")] + pub managed_by: Option, + #[serde(rename = "managedByExtended", default, skip_serializing_if = "Vec::is_empty")] + pub managed_by_extended: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskAccess { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskAccessList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskAccessProperties { + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "timeCreated", default, skip_serializing_if = "Option::is_none")] + pub time_created: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskAccessUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionSet { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionSetList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionSetParameters { + #[serde(flatten)] + pub sub_resource: SubResource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DiskEncryptionSetType { + EncryptionAtRestWithCustomerKey, + EncryptionAtRestWithPlatformAndCustomerKeys, + ConfidentialVmEncryptedWithCustomerKey, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionSetUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionSetUpdateProperties { + #[serde(rename = "encryptionType", default, skip_serializing_if = "Option::is_none")] + pub encryption_type: Option, + #[serde(rename = "activeKey", default, skip_serializing_if = "Option::is_none")] + pub active_key: Option, + #[serde(rename = "rotationToLatestKeyVersionEnabled", default, skip_serializing_if = "Option::is_none")] + pub rotation_to_latest_key_version_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionSettings { + #[serde(rename = "diskEncryptionKey", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_key: Option, + #[serde(rename = "keyEncryptionKey", default, skip_serializing_if = "Option::is_none")] + pub key_encryption_key: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskImageEncryption { + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskInstanceView { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "encryptionSettings", default, skip_serializing_if = "Vec::is_empty")] + pub encryption_settings: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskProperties { + #[serde(rename = "timeCreated", default, skip_serializing_if = "Option::is_none")] + pub time_created: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, + #[serde(rename = "purchasePlan", default, skip_serializing_if = "Option::is_none")] + pub purchase_plan: Option, + #[serde(rename = "supportedCapabilities", default, skip_serializing_if = "Option::is_none")] + pub supported_capabilities: Option, + #[serde(rename = "creationData")] + pub creation_data: CreationData, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "diskSizeBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_size_bytes: Option, + #[serde(rename = "uniqueId", default, skip_serializing_if = "Option::is_none")] + pub unique_id: Option, + #[serde(rename = "encryptionSettingsCollection", default, skip_serializing_if = "Option::is_none")] + pub encryption_settings_collection: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "diskIOPSReadWrite", default, skip_serializing_if = "Option::is_none")] + pub disk_iops_read_write: Option, + #[serde(rename = "diskMBpsReadWrite", default, skip_serializing_if = "Option::is_none")] + pub disk_m_bps_read_write: Option, + #[serde(rename = "diskIOPSReadOnly", default, skip_serializing_if = "Option::is_none")] + pub disk_iops_read_only: Option, + #[serde(rename = "diskMBpsReadOnly", default, skip_serializing_if = "Option::is_none")] + pub disk_m_bps_read_only: Option, + #[serde(rename = "diskState", default, skip_serializing_if = "Option::is_none")] + pub disk_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "maxShares", default, skip_serializing_if = "Option::is_none")] + pub max_shares: Option, + #[serde(rename = "shareInfo", default, skip_serializing_if = "Vec::is_empty")] + pub share_info: Vec, + #[serde(rename = "networkAccessPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_access_policy: Option, + #[serde(rename = "diskAccessId", default, skip_serializing_if = "Option::is_none")] + pub disk_access_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(rename = "burstingEnabled", default, skip_serializing_if = "Option::is_none")] + pub bursting_enabled: Option, + #[serde(rename = "propertyUpdatesInProgress", default, skip_serializing_if = "Option::is_none")] + pub property_updates_in_progress: Option, + #[serde(rename = "supportsHibernation", default, skip_serializing_if = "Option::is_none")] + pub supports_hibernation: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "completionPercent", default, skip_serializing_if = "Option::is_none")] + pub completion_percent: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +pub mod disk_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HyperVGeneration { + V1, + V2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskRestorePoint { + #[serde(flatten)] + pub proxy_only_resource: ProxyOnlyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskRestorePointList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskRestorePointProperties { + #[serde(rename = "timeCreated", default, skip_serializing_if = "Option::is_none")] + pub time_created: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, + #[serde(rename = "purchasePlan", default, skip_serializing_if = "Option::is_none")] + pub purchase_plan: Option, + #[serde(rename = "supportedCapabilities", default, skip_serializing_if = "Option::is_none")] + pub supported_capabilities: Option, + #[serde(rename = "familyId", default, skip_serializing_if = "Option::is_none")] + pub family_id: Option, + #[serde(rename = "sourceUniqueId", default, skip_serializing_if = "Option::is_none")] + pub source_unique_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "supportsHibernation", default, skip_serializing_if = "Option::is_none")] + pub supports_hibernation: Option, + #[serde(rename = "networkAccessPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_access_policy: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "diskAccessId", default, skip_serializing_if = "Option::is_none")] + pub disk_access_id: Option, + #[serde(rename = "completionPercent", default, skip_serializing_if = "Option::is_none")] + pub completion_percent: Option, + #[serde(rename = "replicationState", default, skip_serializing_if = "Option::is_none")] + pub replication_state: Option, + #[serde(rename = "sourceResourceLocation", default, skip_serializing_if = "Option::is_none")] + pub source_resource_location: Option, +} +pub mod disk_restore_point_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HyperVGeneration { + V1, + V2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskSecurityProfile { + #[serde(rename = "securityType", default, skip_serializing_if = "Option::is_none")] + pub security_type: Option, + #[serde(rename = "secureVMDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub secure_vm_disk_encryption_set_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DiskSecurityType { + TrustedLaunch, + #[serde(rename = "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey")] + ConfidentialVmVmGuestStateOnlyEncryptedWithPlatformKey, + #[serde(rename = "ConfidentialVM_DiskEncryptedWithPlatformKey")] + ConfidentialVmDiskEncryptedWithPlatformKey, + #[serde(rename = "ConfidentialVM_DiskEncryptedWithCustomerKey")] + ConfidentialVmDiskEncryptedWithCustomerKey, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod disk_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + #[serde(rename = "UltraSSD_LRS")] + UltraSsdLrs, + #[serde(rename = "Premium_ZRS")] + PremiumZrs, + #[serde(rename = "StandardSSD_ZRS")] + StandardSsdZrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DiskState { + Unattached, + Attached, + Reserved, + Frozen, + #[serde(rename = "ActiveSAS")] + ActiveSas, + #[serde(rename = "ActiveSASFrozen")] + ActiveSasFrozen, + ReadyToUpload, + ActiveUpload, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskUpdateProperties { + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "encryptionSettingsCollection", default, skip_serializing_if = "Option::is_none")] + pub encryption_settings_collection: Option, + #[serde(rename = "diskIOPSReadWrite", default, skip_serializing_if = "Option::is_none")] + pub disk_iops_read_write: Option, + #[serde(rename = "diskMBpsReadWrite", default, skip_serializing_if = "Option::is_none")] + pub disk_m_bps_read_write: Option, + #[serde(rename = "diskIOPSReadOnly", default, skip_serializing_if = "Option::is_none")] + pub disk_iops_read_only: Option, + #[serde(rename = "diskMBpsReadOnly", default, skip_serializing_if = "Option::is_none")] + pub disk_m_bps_read_only: Option, + #[serde(rename = "maxShares", default, skip_serializing_if = "Option::is_none")] + pub max_shares: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "networkAccessPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_access_policy: Option, + #[serde(rename = "diskAccessId", default, skip_serializing_if = "Option::is_none")] + pub disk_access_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(rename = "burstingEnabled", default, skip_serializing_if = "Option::is_none")] + pub bursting_enabled: Option, + #[serde(rename = "purchasePlan", default, skip_serializing_if = "Option::is_none")] + pub purchase_plan: Option, + #[serde(rename = "supportedCapabilities", default, skip_serializing_if = "Option::is_none")] + pub supported_capabilities: Option, + #[serde(rename = "propertyUpdatesInProgress", default, skip_serializing_if = "Option::is_none")] + pub property_updates_in_progress: Option, + #[serde(rename = "supportsHibernation", default, skip_serializing_if = "Option::is_none")] + pub supports_hibernation: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +pub mod disk_update_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Encryption { + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionImages { + #[serde(rename = "osDiskImage", default, skip_serializing_if = "Option::is_none")] + pub os_disk_image: Option, + #[serde(rename = "dataDiskImages", default, skip_serializing_if = "Vec::is_empty")] + pub data_disk_images: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionSetIdentity { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +pub mod encryption_set_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionSetProperties { + #[serde(rename = "encryptionType", default, skip_serializing_if = "Option::is_none")] + pub encryption_type: Option, + #[serde(rename = "activeKey", default, skip_serializing_if = "Option::is_none")] + pub active_key: Option, + #[serde(rename = "previousKeys", default, skip_serializing_if = "Vec::is_empty")] + pub previous_keys: Vec, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "rotationToLatestKeyVersionEnabled", default, skip_serializing_if = "Option::is_none")] + pub rotation_to_latest_key_version_enabled: Option, + #[serde(rename = "lastKeyRotationTimestamp", default, skip_serializing_if = "Option::is_none")] + pub last_key_rotation_timestamp: Option, + #[serde(rename = "autoKeyRotationError", default, skip_serializing_if = "Option::is_none")] + pub auto_key_rotation_error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionSettingsCollection { + pub enabled: bool, + #[serde(rename = "encryptionSettings", default, skip_serializing_if = "Vec::is_empty")] + pub encryption_settings: Vec, + #[serde(rename = "encryptionSettingsVersion", default, skip_serializing_if = "Option::is_none")] + pub encryption_settings_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionSettingsElement { + #[serde(rename = "diskEncryptionKey", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_key: Option, + #[serde(rename = "keyEncryptionKey", default, skip_serializing_if = "Option::is_none")] + pub key_encryption_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EncryptionType { + EncryptionAtRestWithPlatformKey, + EncryptionAtRestWithCustomerKey, + EncryptionAtRestWithPlatformAndCustomerKeys, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExtendedLocationType { + EdgeZone, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Extension { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Gallery { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplication { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplicationList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplicationProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub eula: Option, + #[serde(rename = "privacyStatementUri", default, skip_serializing_if = "Option::is_none")] + pub privacy_statement_uri: Option, + #[serde(rename = "releaseNoteUri", default, skip_serializing_if = "Option::is_none")] + pub release_note_uri: Option, + #[serde(rename = "endOfLifeDate", default, skip_serializing_if = "Option::is_none")] + pub end_of_life_date: Option, + #[serde(rename = "supportedOSType")] + pub supported_os_type: gallery_application_properties::SupportedOsType, +} +pub mod gallery_application_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SupportedOsType { + Windows, + Linux, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplicationUpdate { + #[serde(flatten)] + pub update_resource_definition: UpdateResourceDefinition, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplicationVersion { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplicationVersionList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplicationVersionProperties { + #[serde(rename = "publishingProfile")] + pub publishing_profile: GalleryApplicationVersionPublishingProfile, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "replicationStatus", default, skip_serializing_if = "Option::is_none")] + pub replication_status: Option, +} +pub mod gallery_application_version_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Failed, + Succeeded, + Deleting, + Migrating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplicationVersionPublishingProfile { + #[serde(flatten)] + pub gallery_artifact_publishing_profile_base: GalleryArtifactPublishingProfileBase, + pub source: UserArtifactSource, + #[serde(rename = "manageActions", default, skip_serializing_if = "Option::is_none")] + pub manage_actions: Option, + #[serde(rename = "enableHealthCheck", default, skip_serializing_if = "Option::is_none")] + pub enable_health_check: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryApplicationVersionUpdate { + #[serde(flatten)] + pub update_resource_definition: UpdateResourceDefinition, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryArtifactPublishingProfileBase { + #[serde(rename = "targetRegions", default, skip_serializing_if = "Vec::is_empty")] + pub target_regions: Vec, + #[serde(rename = "replicaCount", default, skip_serializing_if = "Option::is_none")] + pub replica_count: Option, + #[serde(rename = "excludeFromLatest", default, skip_serializing_if = "Option::is_none")] + pub exclude_from_latest: Option, + #[serde(rename = "publishedDate", default, skip_serializing_if = "Option::is_none")] + pub published_date: Option, + #[serde(rename = "endOfLifeDate", default, skip_serializing_if = "Option::is_none")] + pub end_of_life_date: Option, + #[serde(rename = "storageAccountType", default, skip_serializing_if = "Option::is_none")] + pub storage_account_type: Option, + #[serde(rename = "replicationMode", default, skip_serializing_if = "Option::is_none")] + pub replication_mode: Option, +} +pub mod gallery_artifact_publishing_profile_base { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageAccountType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Standard_ZRS")] + StandardZrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ReplicationMode { + Full, + Shallow, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryArtifactSource { + #[serde(rename = "managedImage")] + pub managed_image: ManagedArtifact, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryArtifactVersionSource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryDataDiskImage { + #[serde(flatten)] + pub gallery_disk_image: GalleryDiskImage, + pub lun: i32, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryDiskImage { + #[serde(rename = "sizeInGB", default, skip_serializing_if = "Option::is_none")] + pub size_in_gb: Option, + #[serde(rename = "hostCaching", default, skip_serializing_if = "Option::is_none")] + pub host_caching: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, +} +pub mod gallery_disk_image { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HostCaching { + None, + ReadOnly, + ReadWrite, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryIdentifier { + #[serde(rename = "uniqueName", default, skip_serializing_if = "Option::is_none")] + pub unique_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImage { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageFeature { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageIdentifier { + pub publisher: String, + pub offer: String, + pub sku: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub eula: Option, + #[serde(rename = "privacyStatementUri", default, skip_serializing_if = "Option::is_none")] + pub privacy_statement_uri: Option, + #[serde(rename = "releaseNoteUri", default, skip_serializing_if = "Option::is_none")] + pub release_note_uri: Option, + #[serde(rename = "osType")] + pub os_type: gallery_image_properties::OsType, + #[serde(rename = "osState")] + pub os_state: gallery_image_properties::OsState, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, + #[serde(rename = "endOfLifeDate", default, skip_serializing_if = "Option::is_none")] + pub end_of_life_date: Option, + pub identifier: GalleryImageIdentifier, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recommended: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub disallowed: Option, + #[serde(rename = "purchasePlan", default, skip_serializing_if = "Option::is_none")] + pub purchase_plan: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub features: Vec, +} +pub mod gallery_image_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsState { + Generalized, + Specialized, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HyperVGeneration { + V1, + V2, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Failed, + Succeeded, + Deleting, + Migrating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageUpdate { + #[serde(flatten)] + pub update_resource_definition: UpdateResourceDefinition, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageVersion { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageVersionList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageVersionProperties { + #[serde(rename = "publishingProfile", default, skip_serializing_if = "Option::is_none")] + pub publishing_profile: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "storageProfile")] + pub storage_profile: GalleryImageVersionStorageProfile, + #[serde(rename = "replicationStatus", default, skip_serializing_if = "Option::is_none")] + pub replication_status: Option, +} +pub mod gallery_image_version_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Failed, + Succeeded, + Deleting, + Migrating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageVersionPublishingProfile { + #[serde(flatten)] + pub gallery_artifact_publishing_profile_base: GalleryArtifactPublishingProfileBase, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageVersionStorageProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(rename = "osDiskImage", default, skip_serializing_if = "Option::is_none")] + pub os_disk_image: Option, + #[serde(rename = "dataDiskImages", default, skip_serializing_if = "Vec::is_empty")] + pub data_disk_images: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryImageVersionUpdate { + #[serde(flatten)] + pub update_resource_definition: UpdateResourceDefinition, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryOsDiskImage { + #[serde(flatten)] + pub gallery_disk_image: GalleryDiskImage, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identifier: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "sharingProfile", default, skip_serializing_if = "Option::is_none")] + pub sharing_profile: Option, + #[serde(rename = "softDeletePolicy", default, skip_serializing_if = "Option::is_none")] + pub soft_delete_policy: Option, +} +pub mod gallery_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Failed, + Succeeded, + Deleting, + Migrating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GalleryUpdate { + #[serde(flatten)] + pub update_resource_definition: UpdateResourceDefinition, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GrantAccessData { + pub access: grant_access_data::Access, + #[serde(rename = "durationInSeconds")] + pub duration_in_seconds: i32, + #[serde(rename = "getSecureVMGuestStateSAS", default, skip_serializing_if = "Option::is_none")] + pub get_secure_vm_guest_state_sas: Option, +} +pub mod grant_access_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Access { + None, + Read, + Write, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HardwareProfile { + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "vmSizeProperties", default, skip_serializing_if = "Option::is_none")] + pub vm_size_properties: Option, +} +pub mod hardware_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VmSize { + #[serde(rename = "Basic_A0")] + BasicA0, + #[serde(rename = "Basic_A1")] + BasicA1, + #[serde(rename = "Basic_A2")] + BasicA2, + #[serde(rename = "Basic_A3")] + BasicA3, + #[serde(rename = "Basic_A4")] + BasicA4, + #[serde(rename = "Standard_A0")] + StandardA0, + #[serde(rename = "Standard_A1")] + StandardA1, + #[serde(rename = "Standard_A2")] + StandardA2, + #[serde(rename = "Standard_A3")] + StandardA3, + #[serde(rename = "Standard_A4")] + StandardA4, + #[serde(rename = "Standard_A5")] + StandardA5, + #[serde(rename = "Standard_A6")] + StandardA6, + #[serde(rename = "Standard_A7")] + StandardA7, + #[serde(rename = "Standard_A8")] + StandardA8, + #[serde(rename = "Standard_A9")] + StandardA9, + #[serde(rename = "Standard_A10")] + StandardA10, + #[serde(rename = "Standard_A11")] + StandardA11, + #[serde(rename = "Standard_A1_v2")] + StandardA1V2, + #[serde(rename = "Standard_A2_v2")] + StandardA2V2, + #[serde(rename = "Standard_A4_v2")] + StandardA4V2, + #[serde(rename = "Standard_A8_v2")] + StandardA8V2, + #[serde(rename = "Standard_A2m_v2")] + StandardA2mV2, + #[serde(rename = "Standard_A4m_v2")] + StandardA4mV2, + #[serde(rename = "Standard_A8m_v2")] + StandardA8mV2, + #[serde(rename = "Standard_B1s")] + StandardB1s, + #[serde(rename = "Standard_B1ms")] + StandardB1ms, + #[serde(rename = "Standard_B2s")] + StandardB2s, + #[serde(rename = "Standard_B2ms")] + StandardB2ms, + #[serde(rename = "Standard_B4ms")] + StandardB4ms, + #[serde(rename = "Standard_B8ms")] + StandardB8ms, + #[serde(rename = "Standard_D1")] + StandardD1, + #[serde(rename = "Standard_D2")] + StandardD2, + #[serde(rename = "Standard_D3")] + StandardD3, + #[serde(rename = "Standard_D4")] + StandardD4, + #[serde(rename = "Standard_D11")] + StandardD11, + #[serde(rename = "Standard_D12")] + StandardD12, + #[serde(rename = "Standard_D13")] + StandardD13, + #[serde(rename = "Standard_D14")] + StandardD14, + #[serde(rename = "Standard_D1_v2")] + StandardD1V2, + #[serde(rename = "Standard_D2_v2")] + StandardD2V2, + #[serde(rename = "Standard_D3_v2")] + StandardD3V2, + #[serde(rename = "Standard_D4_v2")] + StandardD4V2, + #[serde(rename = "Standard_D5_v2")] + StandardD5V2, + #[serde(rename = "Standard_D2_v3")] + StandardD2V3, + #[serde(rename = "Standard_D4_v3")] + StandardD4V3, + #[serde(rename = "Standard_D8_v3")] + StandardD8V3, + #[serde(rename = "Standard_D16_v3")] + StandardD16V3, + #[serde(rename = "Standard_D32_v3")] + StandardD32V3, + #[serde(rename = "Standard_D64_v3")] + StandardD64V3, + #[serde(rename = "Standard_D2s_v3")] + StandardD2sV3, + #[serde(rename = "Standard_D4s_v3")] + StandardD4sV3, + #[serde(rename = "Standard_D8s_v3")] + StandardD8sV3, + #[serde(rename = "Standard_D16s_v3")] + StandardD16sV3, + #[serde(rename = "Standard_D32s_v3")] + StandardD32sV3, + #[serde(rename = "Standard_D64s_v3")] + StandardD64sV3, + #[serde(rename = "Standard_D11_v2")] + StandardD11V2, + #[serde(rename = "Standard_D12_v2")] + StandardD12V2, + #[serde(rename = "Standard_D13_v2")] + StandardD13V2, + #[serde(rename = "Standard_D14_v2")] + StandardD14V2, + #[serde(rename = "Standard_D15_v2")] + StandardD15V2, + #[serde(rename = "Standard_DS1")] + StandardDs1, + #[serde(rename = "Standard_DS2")] + StandardDs2, + #[serde(rename = "Standard_DS3")] + StandardDs3, + #[serde(rename = "Standard_DS4")] + StandardDs4, + #[serde(rename = "Standard_DS11")] + StandardDs11, + #[serde(rename = "Standard_DS12")] + StandardDs12, + #[serde(rename = "Standard_DS13")] + StandardDs13, + #[serde(rename = "Standard_DS14")] + StandardDs14, + #[serde(rename = "Standard_DS1_v2")] + StandardDs1V2, + #[serde(rename = "Standard_DS2_v2")] + StandardDs2V2, + #[serde(rename = "Standard_DS3_v2")] + StandardDs3V2, + #[serde(rename = "Standard_DS4_v2")] + StandardDs4V2, + #[serde(rename = "Standard_DS5_v2")] + StandardDs5V2, + #[serde(rename = "Standard_DS11_v2")] + StandardDs11V2, + #[serde(rename = "Standard_DS12_v2")] + StandardDs12V2, + #[serde(rename = "Standard_DS13_v2")] + StandardDs13V2, + #[serde(rename = "Standard_DS14_v2")] + StandardDs14V2, + #[serde(rename = "Standard_DS15_v2")] + StandardDs15V2, + #[serde(rename = "Standard_DS13-4_v2")] + StandardDs134V2, + #[serde(rename = "Standard_DS13-2_v2")] + StandardDs132V2, + #[serde(rename = "Standard_DS14-8_v2")] + StandardDs148V2, + #[serde(rename = "Standard_DS14-4_v2")] + StandardDs144V2, + #[serde(rename = "Standard_E2_v3")] + StandardE2V3, + #[serde(rename = "Standard_E4_v3")] + StandardE4V3, + #[serde(rename = "Standard_E8_v3")] + StandardE8V3, + #[serde(rename = "Standard_E16_v3")] + StandardE16V3, + #[serde(rename = "Standard_E32_v3")] + StandardE32V3, + #[serde(rename = "Standard_E64_v3")] + StandardE64V3, + #[serde(rename = "Standard_E2s_v3")] + StandardE2sV3, + #[serde(rename = "Standard_E4s_v3")] + StandardE4sV3, + #[serde(rename = "Standard_E8s_v3")] + StandardE8sV3, + #[serde(rename = "Standard_E16s_v3")] + StandardE16sV3, + #[serde(rename = "Standard_E32s_v3")] + StandardE32sV3, + #[serde(rename = "Standard_E64s_v3")] + StandardE64sV3, + #[serde(rename = "Standard_E32-16_v3")] + StandardE3216V3, + #[serde(rename = "Standard_E32-8s_v3")] + StandardE328sV3, + #[serde(rename = "Standard_E64-32s_v3")] + StandardE6432sV3, + #[serde(rename = "Standard_E64-16s_v3")] + StandardE6416sV3, + #[serde(rename = "Standard_F1")] + StandardF1, + #[serde(rename = "Standard_F2")] + StandardF2, + #[serde(rename = "Standard_F4")] + StandardF4, + #[serde(rename = "Standard_F8")] + StandardF8, + #[serde(rename = "Standard_F16")] + StandardF16, + #[serde(rename = "Standard_F1s")] + StandardF1s, + #[serde(rename = "Standard_F2s")] + StandardF2s, + #[serde(rename = "Standard_F4s")] + StandardF4s, + #[serde(rename = "Standard_F8s")] + StandardF8s, + #[serde(rename = "Standard_F16s")] + StandardF16s, + #[serde(rename = "Standard_F2s_v2")] + StandardF2sV2, + #[serde(rename = "Standard_F4s_v2")] + StandardF4sV2, + #[serde(rename = "Standard_F8s_v2")] + StandardF8sV2, + #[serde(rename = "Standard_F16s_v2")] + StandardF16sV2, + #[serde(rename = "Standard_F32s_v2")] + StandardF32sV2, + #[serde(rename = "Standard_F64s_v2")] + StandardF64sV2, + #[serde(rename = "Standard_F72s_v2")] + StandardF72sV2, + #[serde(rename = "Standard_G1")] + StandardG1, + #[serde(rename = "Standard_G2")] + StandardG2, + #[serde(rename = "Standard_G3")] + StandardG3, + #[serde(rename = "Standard_G4")] + StandardG4, + #[serde(rename = "Standard_G5")] + StandardG5, + #[serde(rename = "Standard_GS1")] + StandardGs1, + #[serde(rename = "Standard_GS2")] + StandardGs2, + #[serde(rename = "Standard_GS3")] + StandardGs3, + #[serde(rename = "Standard_GS4")] + StandardGs4, + #[serde(rename = "Standard_GS5")] + StandardGs5, + #[serde(rename = "Standard_GS4-8")] + StandardGs48, + #[serde(rename = "Standard_GS4-4")] + StandardGs44, + #[serde(rename = "Standard_GS5-16")] + StandardGs516, + #[serde(rename = "Standard_GS5-8")] + StandardGs58, + #[serde(rename = "Standard_H8")] + StandardH8, + #[serde(rename = "Standard_H16")] + StandardH16, + #[serde(rename = "Standard_H8m")] + StandardH8m, + #[serde(rename = "Standard_H16m")] + StandardH16m, + #[serde(rename = "Standard_H16r")] + StandardH16r, + #[serde(rename = "Standard_H16mr")] + StandardH16mr, + #[serde(rename = "Standard_L4s")] + StandardL4s, + #[serde(rename = "Standard_L8s")] + StandardL8s, + #[serde(rename = "Standard_L16s")] + StandardL16s, + #[serde(rename = "Standard_L32s")] + StandardL32s, + #[serde(rename = "Standard_M64s")] + StandardM64s, + #[serde(rename = "Standard_M64ms")] + StandardM64ms, + #[serde(rename = "Standard_M128s")] + StandardM128s, + #[serde(rename = "Standard_M128ms")] + StandardM128ms, + #[serde(rename = "Standard_M64-32ms")] + StandardM6432ms, + #[serde(rename = "Standard_M64-16ms")] + StandardM6416ms, + #[serde(rename = "Standard_M128-64ms")] + StandardM12864ms, + #[serde(rename = "Standard_M128-32ms")] + StandardM12832ms, + #[serde(rename = "Standard_NC6")] + StandardNc6, + #[serde(rename = "Standard_NC12")] + StandardNc12, + #[serde(rename = "Standard_NC24")] + StandardNc24, + #[serde(rename = "Standard_NC24r")] + StandardNc24r, + #[serde(rename = "Standard_NC6s_v2")] + StandardNc6sV2, + #[serde(rename = "Standard_NC12s_v2")] + StandardNc12sV2, + #[serde(rename = "Standard_NC24s_v2")] + StandardNc24sV2, + #[serde(rename = "Standard_NC24rs_v2")] + StandardNc24rsV2, + #[serde(rename = "Standard_NC6s_v3")] + StandardNc6sV3, + #[serde(rename = "Standard_NC12s_v3")] + StandardNc12sV3, + #[serde(rename = "Standard_NC24s_v3")] + StandardNc24sV3, + #[serde(rename = "Standard_NC24rs_v3")] + StandardNc24rsV3, + #[serde(rename = "Standard_ND6s")] + StandardNd6s, + #[serde(rename = "Standard_ND12s")] + StandardNd12s, + #[serde(rename = "Standard_ND24s")] + StandardNd24s, + #[serde(rename = "Standard_ND24rs")] + StandardNd24rs, + #[serde(rename = "Standard_NV6")] + StandardNv6, + #[serde(rename = "Standard_NV12")] + StandardNv12, + #[serde(rename = "Standard_NV24")] + StandardNv24, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum HyperVGenerationType { + V1, + V2, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Image { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageDataDisk { + #[serde(flatten)] + pub image_disk: ImageDisk, + pub lun: i32, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageDisk { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + #[serde(rename = "managedDisk", default, skip_serializing_if = "Option::is_none")] + pub managed_disk: Option, + #[serde(rename = "blobUri", default, skip_serializing_if = "Option::is_none")] + pub blob_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub caching: Option, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "storageAccountType", default, skip_serializing_if = "Option::is_none")] + pub storage_account_type: Option, + #[serde(rename = "diskEncryptionSet", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set: Option, +} +pub mod image_disk { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Caching { + None, + ReadOnly, + ReadWrite, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageDiskReference { + pub id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageOsDisk { + #[serde(flatten)] + pub image_disk: ImageDisk, + #[serde(rename = "osType")] + pub os_type: image_os_disk::OsType, + #[serde(rename = "osState")] + pub os_state: image_os_disk::OsState, +} +pub mod image_os_disk { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsState { + Generalized, + Specialized, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageProperties { + #[serde(rename = "sourceVirtualMachine", default, skip_serializing_if = "Option::is_none")] + pub source_virtual_machine: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImagePurchasePlan { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub product: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageReference { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub offer: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "exactVersion", default, skip_serializing_if = "Option::is_none")] + pub exact_version: Option, + #[serde(rename = "sharedGalleryImageId", default, skip_serializing_if = "Option::is_none")] + pub shared_gallery_image_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageStorageProfile { + #[serde(rename = "osDisk", default, skip_serializing_if = "Option::is_none")] + pub os_disk: Option, + #[serde(rename = "dataDisks", default, skip_serializing_if = "Vec::is_empty")] + pub data_disks: Vec, + #[serde(rename = "zoneResilient", default, skip_serializing_if = "Option::is_none")] + pub zone_resilient: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InnerError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub exceptiontype: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub errordetail: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InstanceSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InstanceViewStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub level: Option, + #[serde(rename = "displayStatus", default, skip_serializing_if = "Option::is_none")] + pub display_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, +} +pub mod instance_view_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Level { + Info, + Warning, + Error, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InstanceViewStatusesSummary { + #[serde(rename = "statusesSummary", default, skip_serializing_if = "Vec::is_empty")] + pub statuses_summary: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyForDiskEncryptionSet { + #[serde(rename = "sourceVault", default, skip_serializing_if = "Option::is_none")] + pub source_vault: Option, + #[serde(rename = "keyUrl")] + pub key_url: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultAndKeyReference { + #[serde(rename = "sourceVault")] + pub source_vault: SourceVault, + #[serde(rename = "keyUrl")] + pub key_url: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultAndSecretReference { + #[serde(rename = "sourceVault")] + pub source_vault: SourceVault, + #[serde(rename = "secretUrl")] + pub secret_url: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultKeyReference { + #[serde(rename = "keyUrl")] + pub key_url: String, + #[serde(rename = "sourceVault")] + pub source_vault: SubResource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultSecretReference { + #[serde(rename = "secretUrl")] + pub secret_url: String, + #[serde(rename = "sourceVault")] + pub source_vault: SubResource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LastPatchInstallationSummary { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "installationActivityId", default, skip_serializing_if = "Option::is_none")] + pub installation_activity_id: Option, + #[serde(rename = "maintenanceWindowExceeded", default, skip_serializing_if = "Option::is_none")] + pub maintenance_window_exceeded: Option, + #[serde(rename = "notSelectedPatchCount", default, skip_serializing_if = "Option::is_none")] + pub not_selected_patch_count: Option, + #[serde(rename = "excludedPatchCount", default, skip_serializing_if = "Option::is_none")] + pub excluded_patch_count: Option, + #[serde(rename = "pendingPatchCount", default, skip_serializing_if = "Option::is_none")] + pub pending_patch_count: Option, + #[serde(rename = "installedPatchCount", default, skip_serializing_if = "Option::is_none")] + pub installed_patch_count: Option, + #[serde(rename = "failedPatchCount", default, skip_serializing_if = "Option::is_none")] + pub failed_patch_count: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "lastModifiedTime", default, skip_serializing_if = "Option::is_none")] + pub last_modified_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod last_patch_installation_summary { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Unknown, + InProgress, + Failed, + Succeeded, + CompletedWithWarnings, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinuxConfiguration { + #[serde(rename = "disablePasswordAuthentication", default, skip_serializing_if = "Option::is_none")] + pub disable_password_authentication: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ssh: Option, + #[serde(rename = "provisionVMAgent", default, skip_serializing_if = "Option::is_none")] + pub provision_vm_agent: Option, + #[serde(rename = "patchSettings", default, skip_serializing_if = "Option::is_none")] + pub patch_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinuxParameters { + #[serde(rename = "classificationsToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub classifications_to_include: Vec, + #[serde(rename = "packageNameMasksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub package_name_masks_to_include: Vec, + #[serde(rename = "packageNameMasksToExclude", default, skip_serializing_if = "Vec::is_empty")] + pub package_name_masks_to_exclude: Vec, + #[serde(rename = "maintenanceRunId", default, skip_serializing_if = "Option::is_none")] + pub maintenance_run_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinuxPatchSettings { + #[serde(rename = "patchMode", default, skip_serializing_if = "Option::is_none")] + pub patch_mode: Option, + #[serde(rename = "assessmentMode", default, skip_serializing_if = "Option::is_none")] + pub assessment_mode: Option, +} +pub mod linux_patch_settings { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PatchMode { + ImageDefault, + AutomaticByPlatform, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AssessmentMode { + ImageDefault, + AutomaticByPlatform, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListUsagesResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancerConfiguration { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + pub name: String, + pub properties: LoadBalancerConfigurationProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancerConfigurationProperties { + #[serde(rename = "frontendIPConfigurations")] + pub frontend_ip_configurations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancerFrontendIpConfiguration { + pub name: String, + pub properties: LoadBalancerFrontendIpConfigurationProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancerFrontendIpConfigurationProperties { + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogAnalyticsInputBase { + #[serde(rename = "blobContainerSasUri")] + pub blob_container_sas_uri: String, + #[serde(rename = "fromTime")] + pub from_time: String, + #[serde(rename = "toTime")] + pub to_time: String, + #[serde(rename = "groupByThrottlePolicy", default, skip_serializing_if = "Option::is_none")] + pub group_by_throttle_policy: Option, + #[serde(rename = "groupByOperationName", default, skip_serializing_if = "Option::is_none")] + pub group_by_operation_name: Option, + #[serde(rename = "groupByResourceName", default, skip_serializing_if = "Option::is_none")] + pub group_by_resource_name: Option, + #[serde(rename = "groupByClientApplicationId", default, skip_serializing_if = "Option::is_none")] + pub group_by_client_application_id: Option, + #[serde(rename = "groupByUserAgent", default, skip_serializing_if = "Option::is_none")] + pub group_by_user_agent: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogAnalyticsOperationResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogAnalyticsOutput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub output: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceRedeployStatus { + #[serde(rename = "isCustomerInitiatedMaintenanceAllowed", default, skip_serializing_if = "Option::is_none")] + pub is_customer_initiated_maintenance_allowed: Option, + #[serde(rename = "preMaintenanceWindowStartTime", default, skip_serializing_if = "Option::is_none")] + pub pre_maintenance_window_start_time: Option, + #[serde(rename = "preMaintenanceWindowEndTime", default, skip_serializing_if = "Option::is_none")] + pub pre_maintenance_window_end_time: Option, + #[serde(rename = "maintenanceWindowStartTime", default, skip_serializing_if = "Option::is_none")] + pub maintenance_window_start_time: Option, + #[serde(rename = "maintenanceWindowEndTime", default, skip_serializing_if = "Option::is_none")] + pub maintenance_window_end_time: Option, + #[serde(rename = "lastOperationResultCode", default, skip_serializing_if = "Option::is_none")] + pub last_operation_result_code: Option, + #[serde(rename = "lastOperationMessage", default, skip_serializing_if = "Option::is_none")] + pub last_operation_message: Option, +} +pub mod maintenance_redeploy_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastOperationResultCode { + None, + RetryLater, + MaintenanceAborted, + MaintenanceCompleted, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedArtifact { + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedDiskParameters { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(rename = "storageAccountType", default, skip_serializing_if = "Option::is_none")] + pub storage_account_type: Option, + #[serde(rename = "diskEncryptionSet", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NetworkAccessPolicy { + AllowAll, + AllowPrivate, + DenyAll, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkInterfaceReference { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkInterfaceReferenceProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, +} +pub mod network_interface_reference_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteOption { + Delete, + Detach, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkProfile { + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, + #[serde(rename = "networkApiVersion", default, skip_serializing_if = "Option::is_none")] + pub network_api_version: Option, + #[serde(rename = "networkInterfaceConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub network_interface_configurations: Vec, +} +pub mod network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkApiVersion { + #[serde(rename = "2020-11-01")] + N2020_11_01, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsDisk { + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "encryptionSettings", default, skip_serializing_if = "Option::is_none")] + pub encryption_settings: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vhd: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub image: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub caching: Option, + #[serde(rename = "writeAcceleratorEnabled", default, skip_serializing_if = "Option::is_none")] + pub write_accelerator_enabled: Option, + #[serde(rename = "diffDiskSettings", default, skip_serializing_if = "Option::is_none")] + pub diff_disk_settings: Option, + #[serde(rename = "createOption")] + pub create_option: CreateOption, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "managedDisk", default, skip_serializing_if = "Option::is_none")] + pub managed_disk: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, +} +pub mod os_disk { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsDiskImage { + #[serde(rename = "operatingSystem")] + pub operating_system: os_disk_image::OperatingSystem, +} +pub mod os_disk_image { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OperatingSystem { + Windows, + Linux, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsDiskImageEncryption { + #[serde(flatten)] + pub disk_image_encryption: DiskImageEncryption, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsFamily { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsFamilyListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsFamilyProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub versions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsProfile { + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[serde(rename = "adminUsername", default, skip_serializing_if = "Option::is_none")] + pub admin_username: Option, + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[serde(rename = "customData", default, skip_serializing_if = "Option::is_none")] + pub custom_data: Option, + #[serde(rename = "windowsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub windows_configuration: Option, + #[serde(rename = "linuxConfiguration", default, skip_serializing_if = "Option::is_none")] + pub linux_configuration: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub secrets: Vec, + #[serde(rename = "allowExtensionOperations", default, skip_serializing_if = "Option::is_none")] + pub allow_extension_operations: Option, + #[serde(rename = "requireGuestProvisionSignal", default, skip_serializing_if = "Option::is_none")] + pub require_guest_provision_signal: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsVersion { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsVersionListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsVersionProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, + #[serde(rename = "familyLabel", default, skip_serializing_if = "Option::is_none")] + pub family_label: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")] + pub is_default: Option, + #[serde(rename = "isActive", default, skip_serializing_if = "Option::is_none")] + pub is_active: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsVersionPropertiesBase { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")] + pub is_default: Option, + #[serde(rename = "isActive", default, skip_serializing_if = "Option::is_none")] + pub is_active: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OrchestrationMode { + Uniform, + Flexible, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrchestrationServiceStateInput { + #[serde(rename = "serviceName")] + pub service_name: orchestration_service_state_input::ServiceName, + pub action: orchestration_service_state_input::Action, +} +pub mod orchestration_service_state_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServiceName { + AutomaticRepairs, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Action { + Resume, + Suspend, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrchestrationServiceSummary { + #[serde(rename = "serviceName", default, skip_serializing_if = "Option::is_none")] + pub service_name: Option, + #[serde(rename = "serviceState", default, skip_serializing_if = "Option::is_none")] + pub service_state: Option, +} +pub mod orchestration_service_summary { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServiceName { + AutomaticRepairs, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServiceState { + NotRunning, + Running, + Suspended, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PatchInstallationDetail { + #[serde(rename = "patchId", default, skip_serializing_if = "Option::is_none")] + pub patch_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "kbId", default, skip_serializing_if = "Option::is_none")] + pub kb_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[serde(rename = "installationState", default, skip_serializing_if = "Option::is_none")] + pub installation_state: Option, +} +pub mod patch_installation_detail { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InstallationState { + Unknown, + Installed, + Failed, + Excluded, + NotSelected, + Pending, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PatchSettings { + #[serde(rename = "patchMode", default, skip_serializing_if = "Option::is_none")] + pub patch_mode: Option, + #[serde(rename = "enableHotpatching", default, skip_serializing_if = "Option::is_none")] + pub enable_hotpatching: Option, + #[serde(rename = "assessmentMode", default, skip_serializing_if = "Option::is_none")] + pub assessment_mode: Option, +} +pub mod patch_settings { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PatchMode { + Manual, + #[serde(rename = "AutomaticByOS")] + AutomaticByOs, + AutomaticByPlatform, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AssessmentMode { + ImageDefault, + AutomaticByPlatform, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PirCommunityGalleryResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identifier: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PirResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PirSharedGalleryResource { + #[serde(flatten)] + pub pir_resource: PirResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identifier: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Plan { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub product: Option, + #[serde(rename = "promotionCode", default, skip_serializing_if = "Option::is_none")] + pub promotion_code: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointConnectionProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointServiceConnectionStatus { + Pending, + Approved, + Rejected, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceProperties { + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PropertyUpdatesInProgress { + #[serde(rename = "targetTier", default, skip_serializing_if = "Option::is_none")] + pub target_tier: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProximityPlacementGroup { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProximityPlacementGroupListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProximityPlacementGroupProperties { + #[serde(rename = "proximityPlacementGroupType", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group_type: Option, + #[serde(rename = "virtualMachines", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_machines: Vec, + #[serde(rename = "virtualMachineScaleSets", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_machine_scale_sets: Vec, + #[serde(rename = "availabilitySets", default, skip_serializing_if = "Vec::is_empty")] + pub availability_sets: Vec, + #[serde(rename = "colocationStatus", default, skip_serializing_if = "Option::is_none")] + pub colocation_status: Option, +} +pub mod proximity_placement_group_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProximityPlacementGroupType { + Standard, + Ultra, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProximityPlacementGroupUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyOnlyResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PublicIpAddressSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod public_ip_address_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + Standard, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Regional, + Global, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PublicNetworkAccess { + Enabled, + Disabled, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PurchasePlan { + pub publisher: String, + pub name: String, + pub product: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecommendedMachineConfiguration { + #[serde(rename = "vCPUs", default, skip_serializing_if = "Option::is_none")] + pub v_cp_us: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryWalkResponse { + #[serde(rename = "walkPerformed", default, skip_serializing_if = "Option::is_none")] + pub walk_performed: Option, + #[serde(rename = "nextPlatformUpdateDomain", default, skip_serializing_if = "Option::is_none")] + pub next_platform_update_domain: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegionalReplicationStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub details: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub progress: Option, +} +pub mod regional_replication_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + Unknown, + Replicating, + Completed, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationStatus { + #[serde(rename = "aggregatedState", default, skip_serializing_if = "Option::is_none")] + pub aggregated_state: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub summary: Vec, +} +pub mod replication_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AggregatedState { + Unknown, + InProgress, + Completed, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RequestRateByIntervalInput { + #[serde(flatten)] + pub log_analytics_input_base: LogAnalyticsInputBase, + #[serde(rename = "intervalLength")] + pub interval_length: request_rate_by_interval_input::IntervalLength, +} +pub mod request_rate_by_interval_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum IntervalLength { + ThreeMins, + FiveMins, + ThirtyMins, + SixtyMins, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceInstanceViewStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(rename = "displayStatus", default, skip_serializing_if = "Option::is_none")] + pub display_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub level: Option, +} +pub mod resource_instance_view_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Level { + Info, + Warning, + Error, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceRange { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub min: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub max: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSku { + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[serde(rename = "locationInfo", default, skip_serializing_if = "Vec::is_empty")] + pub location_info: Vec, + #[serde(rename = "apiVersions", default, skip_serializing_if = "Vec::is_empty")] + pub api_versions: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub costs: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub restrictions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuCapabilities { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuCapacity { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minimum: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maximum: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, + #[serde(rename = "scaleType", default, skip_serializing_if = "Option::is_none")] + pub scale_type: Option, +} +pub mod resource_sku_capacity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScaleType { + Automatic, + Manual, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuCosts { + #[serde(rename = "meterID", default, skip_serializing_if = "Option::is_none")] + pub meter_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantity: Option, + #[serde(rename = "extendedUnit", default, skip_serializing_if = "Option::is_none")] + pub extended_unit: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuLocationInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "zoneDetails", default, skip_serializing_if = "Vec::is_empty")] + pub zone_details: Vec, + #[serde(rename = "extendedLocations", default, skip_serializing_if = "Vec::is_empty")] + pub extended_locations: Vec, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod resource_sku_location_info { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + EdgeZone, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuRestrictionInfo { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuRestrictions { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, + #[serde(rename = "restrictionInfo", default, skip_serializing_if = "Option::is_none")] + pub restriction_info: Option, + #[serde(rename = "reasonCode", default, skip_serializing_if = "Option::is_none")] + pub reason_code: Option, +} +pub mod resource_sku_restrictions { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Location, + Zone, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ReasonCode { + QuotaId, + NotAvailableForSubscription, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuZoneDetails { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub name: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkusResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceUriList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePoint { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointCollection { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointCollectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointCollectionProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "restorePointCollectionId", default, skip_serializing_if = "Option::is_none")] + pub restore_point_collection_id: Option, + #[serde(rename = "restorePoints", default, skip_serializing_if = "Vec::is_empty")] + pub restore_points: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointCollectionSourceProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointCollectionUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointProperties { + #[serde(rename = "excludeDisks", default, skip_serializing_if = "Vec::is_empty")] + pub exclude_disks: Vec, + #[serde(rename = "sourceMetadata", default, skip_serializing_if = "Option::is_none")] + pub source_metadata: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "consistencyMode", default, skip_serializing_if = "Option::is_none")] + pub consistency_mode: Option, + #[serde(rename = "timeCreated", default, skip_serializing_if = "Option::is_none")] + pub time_created: Option, +} +pub mod restore_point_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConsistencyMode { + CrashConsistent, + FileSystemConsistent, + ApplicationConsistent, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointSourceMetadata { + #[serde(rename = "hardwareProfile", default, skip_serializing_if = "Option::is_none")] + pub hardware_profile: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[serde(rename = "diagnosticsProfile", default, skip_serializing_if = "Option::is_none")] + pub diagnostics_profile: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointSourceVmDataDisk { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub caching: Option, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "managedDisk", default, skip_serializing_if = "Option::is_none")] + pub managed_disk: Option, + #[serde(rename = "diskRestorePoint", default, skip_serializing_if = "Option::is_none")] + pub disk_restore_point: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointSourceVmosDisk { + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "encryptionSettings", default, skip_serializing_if = "Option::is_none")] + pub encryption_settings: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub caching: Option, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "managedDisk", default, skip_serializing_if = "Option::is_none")] + pub managed_disk: Option, + #[serde(rename = "diskRestorePoint", default, skip_serializing_if = "Option::is_none")] + pub disk_restore_point: Option, +} +pub mod restore_point_source_vmos_disk { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorePointSourceVmStorageProfile { + #[serde(rename = "osDisk", default, skip_serializing_if = "Option::is_none")] + pub os_disk: Option, + #[serde(rename = "dataDisks", default, skip_serializing_if = "Vec::is_empty")] + pub data_disks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetrieveBootDiagnosticsDataResult { + #[serde(rename = "consoleScreenshotBlobUri", default, skip_serializing_if = "Option::is_none")] + pub console_screenshot_blob_uri: Option, + #[serde(rename = "serialConsoleLogBlobUri", default, skip_serializing_if = "Option::is_none")] + pub serial_console_log_blob_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleInstance { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleInstanceInstanceView { + #[serde(rename = "platformUpdateDomain", default, skip_serializing_if = "Option::is_none")] + pub platform_update_domain: Option, + #[serde(rename = "platformFaultDomain", default, skip_serializing_if = "Option::is_none")] + pub platform_fault_domain: Option, + #[serde(rename = "privateId", default, skip_serializing_if = "Option::is_none")] + pub private_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleInstanceListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleInstanceNetworkProfile { + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleInstanceProperties { + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleInstances { + #[serde(rename = "roleInstances")] + pub role_instances: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RollbackStatusInfo { + #[serde(rename = "successfullyRolledbackInstanceCount", default, skip_serializing_if = "Option::is_none")] + pub successfully_rolledback_instance_count: Option, + #[serde(rename = "failedRolledbackInstanceCount", default, skip_serializing_if = "Option::is_none")] + pub failed_rolledback_instance_count: Option, + #[serde(rename = "rollbackError", default, skip_serializing_if = "Option::is_none")] + pub rollback_error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RollingUpgradePolicy { + #[serde(rename = "maxBatchInstancePercent", default, skip_serializing_if = "Option::is_none")] + pub max_batch_instance_percent: Option, + #[serde(rename = "maxUnhealthyInstancePercent", default, skip_serializing_if = "Option::is_none")] + pub max_unhealthy_instance_percent: Option, + #[serde(rename = "maxUnhealthyUpgradedInstancePercent", default, skip_serializing_if = "Option::is_none")] + pub max_unhealthy_upgraded_instance_percent: Option, + #[serde(rename = "pauseTimeBetweenBatches", default, skip_serializing_if = "Option::is_none")] + pub pause_time_between_batches: Option, + #[serde(rename = "enableCrossZoneUpgrade", default, skip_serializing_if = "Option::is_none")] + pub enable_cross_zone_upgrade: Option, + #[serde(rename = "prioritizeUnhealthyInstances", default, skip_serializing_if = "Option::is_none")] + pub prioritize_unhealthy_instances: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RollingUpgradeProgressInfo { + #[serde(rename = "successfulInstanceCount", default, skip_serializing_if = "Option::is_none")] + pub successful_instance_count: Option, + #[serde(rename = "failedInstanceCount", default, skip_serializing_if = "Option::is_none")] + pub failed_instance_count: Option, + #[serde(rename = "inProgressInstanceCount", default, skip_serializing_if = "Option::is_none")] + pub in_progress_instance_count: Option, + #[serde(rename = "pendingInstanceCount", default, skip_serializing_if = "Option::is_none")] + pub pending_instance_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RollingUpgradeRunningStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "lastAction", default, skip_serializing_if = "Option::is_none")] + pub last_action: Option, + #[serde(rename = "lastActionTime", default, skip_serializing_if = "Option::is_none")] + pub last_action_time: Option, +} +pub mod rolling_upgrade_running_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + RollingForward, + Cancelled, + Completed, + Faulted, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastAction { + Start, + Cancel, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RollingUpgradeStatusInfo { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RollingUpgradeStatusInfoProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub policy: Option, + #[serde(rename = "runningStatus", default, skip_serializing_if = "Option::is_none")] + pub running_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub progress: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandDocument { + #[serde(flatten)] + pub run_command_document_base: RunCommandDocumentBase, + pub script: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub parameters: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandDocumentBase { + #[serde(rename = "$schema")] + pub schema: String, + pub id: String, + #[serde(rename = "osType")] + pub os_type: run_command_document_base::OsType, + pub label: String, + pub description: String, +} +pub mod run_command_document_base { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandInput { + #[serde(rename = "commandId")] + pub command_id: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub script: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub parameters: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandInputParameter { + pub name: String, + pub value: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandParameterDefinition { + pub name: String, + #[serde(rename = "type")] + pub type_: String, + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub required: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScaleInPolicy { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, + #[serde(rename = "forceDeletion", default, skip_serializing_if = "Option::is_none")] + pub force_deletion: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduledEventsProfile { + #[serde(rename = "terminateNotificationProfile", default, skip_serializing_if = "Option::is_none")] + pub terminate_notification_profile: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityProfile { + #[serde(rename = "uefiSettings", default, skip_serializing_if = "Option::is_none")] + pub uefi_settings: Option, + #[serde(rename = "encryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub encryption_at_host: Option, + #[serde(rename = "securityType", default, skip_serializing_if = "Option::is_none")] + pub security_type: Option, +} +pub mod security_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SecurityType { + TrustedLaunch, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShareInfoElement { + #[serde(rename = "vmUri", default, skip_serializing_if = "Option::is_none")] + pub vm_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGallery { + #[serde(flatten)] + pub pir_shared_gallery_resource: PirSharedGalleryResource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGalleryIdentifier { + #[serde(rename = "uniqueId", default, skip_serializing_if = "Option::is_none")] + pub unique_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGalleryImage { + #[serde(flatten)] + pub pir_shared_gallery_resource: PirSharedGalleryResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGalleryImageList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGalleryImageProperties { + #[serde(rename = "osType")] + pub os_type: shared_gallery_image_properties::OsType, + #[serde(rename = "osState")] + pub os_state: shared_gallery_image_properties::OsState, + #[serde(rename = "endOfLifeDate", default, skip_serializing_if = "Option::is_none")] + pub end_of_life_date: Option, + pub identifier: GalleryImageIdentifier, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recommended: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub disallowed: Option, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub features: Vec, + #[serde(rename = "purchasePlan", default, skip_serializing_if = "Option::is_none")] + pub purchase_plan: Option, +} +pub mod shared_gallery_image_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsState { + Generalized, + Specialized, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HyperVGeneration { + V1, + V2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGalleryImageVersion { + #[serde(flatten)] + pub pir_shared_gallery_resource: PirSharedGalleryResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGalleryImageVersionList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGalleryImageVersionProperties { + #[serde(rename = "publishedDate", default, skip_serializing_if = "Option::is_none")] + pub published_date: Option, + #[serde(rename = "endOfLifeDate", default, skip_serializing_if = "Option::is_none")] + pub end_of_life_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharedGalleryList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharingProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub permissions: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub groups: Vec, +} +pub mod sharing_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Permissions { + Private, + Groups, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharingProfileGroup { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ids: Vec, +} +pub mod sharing_profile_group { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Subscriptions, + #[serde(rename = "AADTenants")] + AadTenants, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharingUpdate { + #[serde(rename = "operationType")] + pub operation_type: sharing_update::OperationType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub groups: Vec, +} +pub mod sharing_update { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OperationType { + Add, + Remove, + Reset, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Snapshot { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "managedBy", default, skip_serializing_if = "Option::is_none")] + pub managed_by: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotList { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotProperties { + #[serde(rename = "timeCreated", default, skip_serializing_if = "Option::is_none")] + pub time_created: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, + #[serde(rename = "purchasePlan", default, skip_serializing_if = "Option::is_none")] + pub purchase_plan: Option, + #[serde(rename = "supportedCapabilities", default, skip_serializing_if = "Option::is_none")] + pub supported_capabilities: Option, + #[serde(rename = "creationData")] + pub creation_data: CreationData, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "diskSizeBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_size_bytes: Option, + #[serde(rename = "diskState", default, skip_serializing_if = "Option::is_none")] + pub disk_state: Option, + #[serde(rename = "uniqueId", default, skip_serializing_if = "Option::is_none")] + pub unique_id: Option, + #[serde(rename = "encryptionSettingsCollection", default, skip_serializing_if = "Option::is_none")] + pub encryption_settings_collection: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub incremental: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "networkAccessPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_access_policy: Option, + #[serde(rename = "diskAccessId", default, skip_serializing_if = "Option::is_none")] + pub disk_access_id: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "supportsHibernation", default, skip_serializing_if = "Option::is_none")] + pub supports_hibernation: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "completionPercent", default, skip_serializing_if = "Option::is_none")] + pub completion_percent: Option, +} +pub mod snapshot_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HyperVGeneration { + V1, + V2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod snapshot_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "Standard_ZRS")] + StandardZrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotUpdateProperties { + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "encryptionSettingsCollection", default, skip_serializing_if = "Option::is_none")] + pub encryption_settings_collection: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "networkAccessPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_access_policy: Option, + #[serde(rename = "diskAccessId", default, skip_serializing_if = "Option::is_none")] + pub disk_access_id: Option, + #[serde(rename = "supportsHibernation", default, skip_serializing_if = "Option::is_none")] + pub supports_hibernation: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "supportedCapabilities", default, skip_serializing_if = "Option::is_none")] + pub supported_capabilities: Option, +} +pub mod snapshot_update_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SoftDeletePolicy { + #[serde(rename = "isSoftDeleteEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_soft_delete_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceVault { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SpotRestorePolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "restoreTimeout", default, skip_serializing_if = "Option::is_none")] + pub restore_timeout: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SshConfiguration { + #[serde(rename = "publicKeys", default, skip_serializing_if = "Vec::is_empty")] + pub public_keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SshPublicKey { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "keyData", default, skip_serializing_if = "Option::is_none")] + pub key_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SshPublicKeyGenerateKeyPairResult { + #[serde(rename = "privateKey")] + pub private_key: String, + #[serde(rename = "publicKey")] + pub public_key: String, + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SshPublicKeyResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SshPublicKeyResourceProperties { + #[serde(rename = "publicKey", default, skip_serializing_if = "Option::is_none")] + pub public_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SshPublicKeyUpdateResource { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SshPublicKeysGroupListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StatusCodeCount { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum StorageAccountType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + #[serde(rename = "UltraSSD_LRS")] + UltraSsdLrs, + #[serde(rename = "Premium_ZRS")] + PremiumZrs, + #[serde(rename = "StandardSSD_ZRS")] + StandardSsdZrs, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageProfile { + #[serde(rename = "imageReference", default, skip_serializing_if = "Option::is_none")] + pub image_reference: Option, + #[serde(rename = "osDisk", default, skip_serializing_if = "Option::is_none")] + pub os_disk: Option, + #[serde(rename = "dataDisks", default, skip_serializing_if = "Vec::is_empty")] + pub data_disks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResourceReadOnly { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResourceWithColocationStatus { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(rename = "colocationStatus", default, skip_serializing_if = "Option::is_none")] + pub colocation_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedCapabilities { + #[serde(rename = "acceleratedNetwork", default, skip_serializing_if = "Option::is_none")] + pub accelerated_network: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetRegion { + pub name: String, + #[serde(rename = "regionalReplicaCount", default, skip_serializing_if = "Option::is_none")] + pub regional_replica_count: Option, + #[serde(rename = "storageAccountType", default, skip_serializing_if = "Option::is_none")] + pub storage_account_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, +} +pub mod target_region { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageAccountType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Standard_ZRS")] + StandardZrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TerminateNotificationProfile { + #[serde(rename = "notBeforeTimeout", default, skip_serializing_if = "Option::is_none")] + pub not_before_timeout: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enable: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThrottledRequestsInput { + #[serde(flatten)] + pub log_analytics_input_base: LogAnalyticsInputBase, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UefiSettings { + #[serde(rename = "secureBootEnabled", default, skip_serializing_if = "Option::is_none")] + pub secure_boot_enabled: Option, + #[serde(rename = "vTpmEnabled", default, skip_serializing_if = "Option::is_none")] + pub v_tpm_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateDomain { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateDomainListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateResourceDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradeOperationHistoricalStatusInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradeOperationHistoricalStatusInfoProperties { + #[serde(rename = "runningStatus", default, skip_serializing_if = "Option::is_none")] + pub running_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub progress: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "startedBy", default, skip_serializing_if = "Option::is_none")] + pub started_by: Option, + #[serde(rename = "targetImageReference", default, skip_serializing_if = "Option::is_none")] + pub target_image_reference: Option, + #[serde(rename = "rollbackInfo", default, skip_serializing_if = "Option::is_none")] + pub rollback_info: Option, +} +pub mod upgrade_operation_historical_status_info_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StartedBy { + Unknown, + User, + Platform, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradeOperationHistoryStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +pub mod upgrade_operation_history_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + RollingForward, + Cancelled, + Completed, + Faulted, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradePolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "rollingUpgradePolicy", default, skip_serializing_if = "Option::is_none")] + pub rolling_upgrade_policy: Option, + #[serde(rename = "automaticOSUpgradePolicy", default, skip_serializing_if = "Option::is_none")] + pub automatic_os_upgrade_policy: Option, +} +pub mod upgrade_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + Automatic, + Manual, + Rolling, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Usage { + pub unit: usage::Unit, + #[serde(rename = "currentValue")] + pub current_value: i32, + pub limit: i64, + pub name: UsageName, +} +pub mod usage { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UsageName { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserArtifactManage { + pub install: String, + pub remove: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub update: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserArtifactSource { + #[serde(rename = "mediaLink")] + pub media_link: String, + #[serde(rename = "defaultConfigurationLink", default, skip_serializing_if = "Option::is_none")] + pub default_configuration_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmGalleryApplication { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub order: Option, + #[serde(rename = "packageReferenceId")] + pub package_reference_id: String, + #[serde(rename = "configurationReference", default, skip_serializing_if = "Option::is_none")] + pub configuration_reference: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmScaleSetConvertToSinglePlacementGroupInput { + #[serde(rename = "activePlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub active_placement_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmSizeProperties { + #[serde(rename = "vCPUsAvailable", default, skip_serializing_if = "Option::is_none")] + pub v_cp_us_available: Option, + #[serde(rename = "vCPUsPerCore", default, skip_serializing_if = "Option::is_none")] + pub v_cp_us_per_core: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultCertificate { + #[serde(rename = "certificateUrl", default, skip_serializing_if = "Option::is_none")] + pub certificate_url: Option, + #[serde(rename = "certificateStore", default, skip_serializing_if = "Option::is_none")] + pub certificate_store: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultSecretGroup { + #[serde(rename = "sourceVault", default, skip_serializing_if = "Option::is_none")] + pub source_vault: Option, + #[serde(rename = "vaultCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub vault_certificates: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualHardDisk { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachine { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub plan: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineAgentInstanceView { + #[serde(rename = "vmAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub vm_agent_version: Option, + #[serde(rename = "extensionHandlers", default, skip_serializing_if = "Vec::is_empty")] + pub extension_handlers: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineAssessPatchesResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "assessmentActivityId", default, skip_serializing_if = "Option::is_none")] + pub assessment_activity_id: Option, + #[serde(rename = "rebootPending", default, skip_serializing_if = "Option::is_none")] + pub reboot_pending: Option, + #[serde(rename = "criticalAndSecurityPatchCount", default, skip_serializing_if = "Option::is_none")] + pub critical_and_security_patch_count: Option, + #[serde(rename = "otherPatchCount", default, skip_serializing_if = "Option::is_none")] + pub other_patch_count: Option, + #[serde(rename = "startDateTime", default, skip_serializing_if = "Option::is_none")] + pub start_date_time: Option, + #[serde(rename = "availablePatches", default, skip_serializing_if = "Vec::is_empty")] + pub available_patches: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod virtual_machine_assess_patches_result { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Unknown, + InProgress, + Failed, + Succeeded, + CompletedWithWarnings, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineCaptureParameters { + #[serde(rename = "vhdPrefix")] + pub vhd_prefix: String, + #[serde(rename = "destinationContainerName")] + pub destination_container_name: String, + #[serde(rename = "overwriteVhds")] + pub overwrite_vhds: bool, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineCaptureResult { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(rename = "$schema", default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "contentVersion", default, skip_serializing_if = "Option::is_none")] + pub content_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtension { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtensionHandlerInstanceView { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtensionImage { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtensionImageProperties { + #[serde(rename = "operatingSystem")] + pub operating_system: String, + #[serde(rename = "computeRole")] + pub compute_role: String, + #[serde(rename = "handlerSchema")] + pub handler_schema: String, + #[serde(rename = "vmScaleSetEnabled", default, skip_serializing_if = "Option::is_none")] + pub vm_scale_set_enabled: Option, + #[serde(rename = "supportsMultipleExtensions", default, skip_serializing_if = "Option::is_none")] + pub supports_multiple_extensions: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtensionInstanceView { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub substatuses: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtensionProperties { + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[serde(rename = "enableAutomaticUpgrade", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_upgrade: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[serde(rename = "protectedSettings", default, skip_serializing_if = "Option::is_none")] + pub protected_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, + #[serde(rename = "suppressFailures", default, skip_serializing_if = "Option::is_none")] + pub suppress_failures: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtensionUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtensionUpdateProperties { + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[serde(rename = "enableAutomaticUpgrade", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_upgrade: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[serde(rename = "protectedSettings", default, skip_serializing_if = "Option::is_none")] + pub protected_settings: Option, + #[serde(rename = "suppressFailures", default, skip_serializing_if = "Option::is_none")] + pub suppress_failures: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineExtensionsListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineHealthStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod virtual_machine_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineImage { + #[serde(flatten)] + pub virtual_machine_image_resource: VirtualMachineImageResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineImageFeature { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineImageProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub plan: Option, + #[serde(rename = "osDiskImage", default, skip_serializing_if = "Option::is_none")] + pub os_disk_image: Option, + #[serde(rename = "dataDiskImages", default, skip_serializing_if = "Vec::is_empty")] + pub data_disk_images: Vec, + #[serde(rename = "automaticOSUpgradeProperties", default, skip_serializing_if = "Option::is_none")] + pub automatic_os_upgrade_properties: Option, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub disallowed: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub features: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineImageResource { + #[serde(flatten)] + pub sub_resource: SubResource, + pub name: String, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineInstallPatchesParameters { + #[serde(rename = "maximumDuration", default, skip_serializing_if = "Option::is_none")] + pub maximum_duration: Option, + #[serde(rename = "rebootSetting")] + pub reboot_setting: virtual_machine_install_patches_parameters::RebootSetting, + #[serde(rename = "windowsParameters", default, skip_serializing_if = "Option::is_none")] + pub windows_parameters: Option, + #[serde(rename = "linuxParameters", default, skip_serializing_if = "Option::is_none")] + pub linux_parameters: Option, +} +pub mod virtual_machine_install_patches_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RebootSetting { + IfRequired, + Never, + Always, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineInstallPatchesResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "installationActivityId", default, skip_serializing_if = "Option::is_none")] + pub installation_activity_id: Option, + #[serde(rename = "rebootStatus", default, skip_serializing_if = "Option::is_none")] + pub reboot_status: Option, + #[serde(rename = "maintenanceWindowExceeded", default, skip_serializing_if = "Option::is_none")] + pub maintenance_window_exceeded: Option, + #[serde(rename = "excludedPatchCount", default, skip_serializing_if = "Option::is_none")] + pub excluded_patch_count: Option, + #[serde(rename = "notSelectedPatchCount", default, skip_serializing_if = "Option::is_none")] + pub not_selected_patch_count: Option, + #[serde(rename = "pendingPatchCount", default, skip_serializing_if = "Option::is_none")] + pub pending_patch_count: Option, + #[serde(rename = "installedPatchCount", default, skip_serializing_if = "Option::is_none")] + pub installed_patch_count: Option, + #[serde(rename = "failedPatchCount", default, skip_serializing_if = "Option::is_none")] + pub failed_patch_count: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub patches: Vec, + #[serde(rename = "startDateTime", default, skip_serializing_if = "Option::is_none")] + pub start_date_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod virtual_machine_install_patches_result { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Unknown, + InProgress, + Failed, + Succeeded, + CompletedWithWarnings, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RebootStatus { + Unknown, + NotNeeded, + Required, + Started, + Failed, + Completed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineInstanceView { + #[serde(rename = "platformUpdateDomain", default, skip_serializing_if = "Option::is_none")] + pub platform_update_domain: Option, + #[serde(rename = "platformFaultDomain", default, skip_serializing_if = "Option::is_none")] + pub platform_fault_domain: Option, + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[serde(rename = "hyperVGeneration", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_generation: Option, + #[serde(rename = "rdpThumbPrint", default, skip_serializing_if = "Option::is_none")] + pub rdp_thumb_print: Option, + #[serde(rename = "vmAgent", default, skip_serializing_if = "Option::is_none")] + pub vm_agent: Option, + #[serde(rename = "maintenanceRedeployStatus", default, skip_serializing_if = "Option::is_none")] + pub maintenance_redeploy_status: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub extensions: Vec, + #[serde(rename = "vmHealth", default, skip_serializing_if = "Option::is_none")] + pub vm_health: Option, + #[serde(rename = "bootDiagnostics", default, skip_serializing_if = "Option::is_none")] + pub boot_diagnostics: Option, + #[serde(rename = "assignedHost", default, skip_serializing_if = "Option::is_none")] + pub assigned_host: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, + #[serde(rename = "patchStatus", default, skip_serializing_if = "Option::is_none")] + pub patch_status: Option, +} +pub mod virtual_machine_instance_view { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HyperVGeneration { + V1, + V2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineIpTag { + #[serde(rename = "ipTagType", default, skip_serializing_if = "Option::is_none")] + pub ip_tag_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineNetworkInterfaceConfiguration { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineNetworkInterfaceConfigurationProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, + #[serde(rename = "enableAcceleratedNetworking", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking: Option, + #[serde(rename = "enableFpga", default, skip_serializing_if = "Option::is_none")] + pub enable_fpga: Option, + #[serde(rename = "enableIPForwarding", default, skip_serializing_if = "Option::is_none")] + pub enable_ip_forwarding: Option, + #[serde(rename = "networkSecurityGroup", default, skip_serializing_if = "Option::is_none")] + pub network_security_group: Option, + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[serde(rename = "ipConfigurations")] + pub ip_configurations: Vec, + #[serde(rename = "dscpConfiguration", default, skip_serializing_if = "Option::is_none")] + pub dscp_configuration: Option, +} +pub mod virtual_machine_network_interface_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteOption { + Delete, + Detach, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineNetworkInterfaceDnsSettingsConfiguration { + #[serde(rename = "dnsServers", default, skip_serializing_if = "Vec::is_empty")] + pub dns_servers: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineNetworkInterfaceIpConfiguration { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineNetworkInterfaceIpConfigurationProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "publicIPAddressConfiguration", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_configuration: Option, + #[serde(rename = "privateIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address_version: Option, + #[serde(rename = "applicationSecurityGroups", default, skip_serializing_if = "Vec::is_empty")] + pub application_security_groups: Vec, + #[serde(rename = "applicationGatewayBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub application_gateway_backend_address_pools: Vec, + #[serde(rename = "loadBalancerBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_backend_address_pools: Vec, +} +pub mod virtual_machine_network_interface_ip_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateIpAddressVersion { + IPv4, + IPv6, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachinePatchStatus { + #[serde(rename = "availablePatchSummary", default, skip_serializing_if = "Option::is_none")] + pub available_patch_summary: Option, + #[serde(rename = "lastPatchInstallationSummary", default, skip_serializing_if = "Option::is_none")] + pub last_patch_installation_summary: Option, + #[serde(rename = "configurationStatuses", default, skip_serializing_if = "Vec::is_empty")] + pub configuration_statuses: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineProperties { + #[serde(rename = "hardwareProfile", default, skip_serializing_if = "Option::is_none")] + pub hardware_profile: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(rename = "additionalCapabilities", default, skip_serializing_if = "Option::is_none")] + pub additional_capabilities: Option, + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "diagnosticsProfile", default, skip_serializing_if = "Option::is_none")] + pub diagnostics_profile: Option, + #[serde(rename = "availabilitySet", default, skip_serializing_if = "Option::is_none")] + pub availability_set: Option, + #[serde(rename = "virtualMachineScaleSet", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_scale_set: Option, + #[serde(rename = "proximityPlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(rename = "evictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub eviction_policy: Option, + #[serde(rename = "billingProfile", default, skip_serializing_if = "Option::is_none")] + pub billing_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, + #[serde(rename = "hostGroup", default, skip_serializing_if = "Option::is_none")] + pub host_group: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "extensionsTimeBudget", default, skip_serializing_if = "Option::is_none")] + pub extensions_time_budget: Option, + #[serde(rename = "platformFaultDomain", default, skip_serializing_if = "Option::is_none")] + pub platform_fault_domain: Option, + #[serde(rename = "scheduledEventsProfile", default, skip_serializing_if = "Option::is_none")] + pub scheduled_events_profile: Option, + #[serde(rename = "userData", default, skip_serializing_if = "Option::is_none")] + pub user_data: Option, + #[serde(rename = "capacityReservation", default, skip_serializing_if = "Option::is_none")] + pub capacity_reservation: Option, + #[serde(rename = "applicationProfile", default, skip_serializing_if = "Option::is_none")] + pub application_profile: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachinePublicIpAddressConfiguration { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachinePublicIpAddressConfigurationProperties { + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[serde(rename = "ipTags", default, skip_serializing_if = "Vec::is_empty")] + pub ip_tags: Vec, + #[serde(rename = "publicIPPrefix", default, skip_serializing_if = "Option::is_none")] + pub public_ip_prefix: Option, + #[serde(rename = "publicIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_version: Option, + #[serde(rename = "publicIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub public_ip_allocation_method: Option, +} +pub mod virtual_machine_public_ip_address_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteOption { + Delete, + Detach, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicIpAddressVersion { + IPv4, + IPv6, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicIpAllocationMethod { + Dynamic, + Static, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachinePublicIpAddressDnsSettingsConfiguration { + #[serde(rename = "domainNameLabel")] + pub domain_name_label: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineReimageParameters { + #[serde(rename = "tempDisk", default, skip_serializing_if = "Option::is_none")] + pub temp_disk: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineRunCommand { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineRunCommandInstanceView { + #[serde(rename = "executionState", default, skip_serializing_if = "Option::is_none")] + pub execution_state: Option, + #[serde(rename = "executionMessage", default, skip_serializing_if = "Option::is_none")] + pub execution_message: Option, + #[serde(rename = "exitCode", default, skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub output: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, +} +pub mod virtual_machine_run_command_instance_view { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ExecutionState { + Unknown, + Pending, + Running, + Failed, + Succeeded, + TimedOut, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineRunCommandProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub parameters: Vec, + #[serde(rename = "protectedParameters", default, skip_serializing_if = "Vec::is_empty")] + pub protected_parameters: Vec, + #[serde(rename = "asyncExecution", default, skip_serializing_if = "Option::is_none")] + pub async_execution: Option, + #[serde(rename = "runAsUser", default, skip_serializing_if = "Option::is_none")] + pub run_as_user: Option, + #[serde(rename = "runAsPassword", default, skip_serializing_if = "Option::is_none")] + pub run_as_password: Option, + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[serde(rename = "outputBlobUri", default, skip_serializing_if = "Option::is_none")] + pub output_blob_uri: Option, + #[serde(rename = "errorBlobUri", default, skip_serializing_if = "Option::is_none")] + pub error_blob_uri: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineRunCommandScriptSource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub script: Option, + #[serde(rename = "scriptUri", default, skip_serializing_if = "Option::is_none")] + pub script_uri: Option, + #[serde(rename = "commandId", default, skip_serializing_if = "Option::is_none")] + pub command_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineRunCommandUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineRunCommandsListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSet { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub plan: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetDataDisk { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + pub lun: i32, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub caching: Option, + #[serde(rename = "writeAcceleratorEnabled", default, skip_serializing_if = "Option::is_none")] + pub write_accelerator_enabled: Option, + #[serde(rename = "createOption")] + pub create_option: CreateOption, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "managedDisk", default, skip_serializing_if = "Option::is_none")] + pub managed_disk: Option, + #[serde(rename = "diskIOPSReadWrite", default, skip_serializing_if = "Option::is_none")] + pub disk_iops_read_write: Option, + #[serde(rename = "diskMBpsReadWrite", default, skip_serializing_if = "Option::is_none")] + pub disk_m_bps_read_write: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetExtension { + #[serde(flatten)] + pub sub_resource_read_only: SubResourceReadOnly, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetExtensionListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetExtensionProfile { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub extensions: Vec, + #[serde(rename = "extensionsTimeBudget", default, skip_serializing_if = "Option::is_none")] + pub extensions_time_budget: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetExtensionProperties { + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[serde(rename = "enableAutomaticUpgrade", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_upgrade: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[serde(rename = "protectedSettings", default, skip_serializing_if = "Option::is_none")] + pub protected_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisionAfterExtensions", default, skip_serializing_if = "Vec::is_empty")] + pub provision_after_extensions: Vec, + #[serde(rename = "suppressFailures", default, skip_serializing_if = "Option::is_none")] + pub suppress_failures: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetExtensionUpdate { + #[serde(flatten)] + pub sub_resource_read_only: SubResourceReadOnly, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetIpConfigurationProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "publicIPAddressConfiguration", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_configuration: Option, + #[serde(rename = "privateIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address_version: Option, + #[serde(rename = "applicationGatewayBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub application_gateway_backend_address_pools: Vec, + #[serde(rename = "applicationSecurityGroups", default, skip_serializing_if = "Vec::is_empty")] + pub application_security_groups: Vec, + #[serde(rename = "loadBalancerBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_backend_address_pools: Vec, + #[serde(rename = "loadBalancerInboundNatPools", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_inbound_nat_pools: Vec, +} +pub mod virtual_machine_scale_set_ip_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateIpAddressVersion { + IPv4, + IPv6, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod virtual_machine_scale_set_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetInstanceView { + #[serde(rename = "virtualMachine", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub extensions: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, + #[serde(rename = "orchestrationServices", default, skip_serializing_if = "Vec::is_empty")] + pub orchestration_services: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetInstanceViewStatusesSummary { + #[serde(rename = "statusesSummary", default, skip_serializing_if = "Vec::is_empty")] + pub statuses_summary: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetIpTag { + #[serde(rename = "ipTagType", default, skip_serializing_if = "Option::is_none")] + pub ip_tag_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetListOsUpgradeHistory { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetListSkusResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetListWithLinkResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetManagedDiskParameters { + #[serde(rename = "storageAccountType", default, skip_serializing_if = "Option::is_none")] + pub storage_account_type: Option, + #[serde(rename = "diskEncryptionSet", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetNetworkConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetNetworkConfigurationDnsSettings { + #[serde(rename = "dnsServers", default, skip_serializing_if = "Vec::is_empty")] + pub dns_servers: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetNetworkConfigurationProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "enableAcceleratedNetworking", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking: Option, + #[serde(rename = "enableFpga", default, skip_serializing_if = "Option::is_none")] + pub enable_fpga: Option, + #[serde(rename = "networkSecurityGroup", default, skip_serializing_if = "Option::is_none")] + pub network_security_group: Option, + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[serde(rename = "ipConfigurations")] + pub ip_configurations: Vec, + #[serde(rename = "enableIPForwarding", default, skip_serializing_if = "Option::is_none")] + pub enable_ip_forwarding: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, +} +pub mod virtual_machine_scale_set_network_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteOption { + Delete, + Detach, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetNetworkProfile { + #[serde(rename = "healthProbe", default, skip_serializing_if = "Option::is_none")] + pub health_probe: Option, + #[serde(rename = "networkInterfaceConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub network_interface_configurations: Vec, + #[serde(rename = "networkApiVersion", default, skip_serializing_if = "Option::is_none")] + pub network_api_version: Option, +} +pub mod virtual_machine_scale_set_network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkApiVersion { + #[serde(rename = "2020-11-01")] + N2020_11_01, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetOsDisk { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub caching: Option, + #[serde(rename = "writeAcceleratorEnabled", default, skip_serializing_if = "Option::is_none")] + pub write_accelerator_enabled: Option, + #[serde(rename = "createOption")] + pub create_option: CreateOption, + #[serde(rename = "diffDiskSettings", default, skip_serializing_if = "Option::is_none")] + pub diff_disk_settings: Option, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub image: Option, + #[serde(rename = "vhdContainers", default, skip_serializing_if = "Vec::is_empty")] + pub vhd_containers: Vec, + #[serde(rename = "managedDisk", default, skip_serializing_if = "Option::is_none")] + pub managed_disk: Option, +} +pub mod virtual_machine_scale_set_os_disk { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OsType { + Windows, + Linux, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetOsProfile { + #[serde(rename = "computerNamePrefix", default, skip_serializing_if = "Option::is_none")] + pub computer_name_prefix: Option, + #[serde(rename = "adminUsername", default, skip_serializing_if = "Option::is_none")] + pub admin_username: Option, + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[serde(rename = "customData", default, skip_serializing_if = "Option::is_none")] + pub custom_data: Option, + #[serde(rename = "windowsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub windows_configuration: Option, + #[serde(rename = "linuxConfiguration", default, skip_serializing_if = "Option::is_none")] + pub linux_configuration: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub secrets: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetProperties { + #[serde(rename = "upgradePolicy", default, skip_serializing_if = "Option::is_none")] + pub upgrade_policy: Option, + #[serde(rename = "automaticRepairsPolicy", default, skip_serializing_if = "Option::is_none")] + pub automatic_repairs_policy: Option, + #[serde(rename = "virtualMachineProfile", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_profile: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub overprovision: Option, + #[serde( + rename = "doNotRunExtensionsOnOverprovisionedVMs", + default, + skip_serializing_if = "Option::is_none" + )] + pub do_not_run_extensions_on_overprovisioned_v_ms: Option, + #[serde(rename = "uniqueId", default, skip_serializing_if = "Option::is_none")] + pub unique_id: Option, + #[serde(rename = "singlePlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub single_placement_group: Option, + #[serde(rename = "zoneBalance", default, skip_serializing_if = "Option::is_none")] + pub zone_balance: Option, + #[serde(rename = "platformFaultDomainCount", default, skip_serializing_if = "Option::is_none")] + pub platform_fault_domain_count: Option, + #[serde(rename = "proximityPlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group: Option, + #[serde(rename = "hostGroup", default, skip_serializing_if = "Option::is_none")] + pub host_group: Option, + #[serde(rename = "additionalCapabilities", default, skip_serializing_if = "Option::is_none")] + pub additional_capabilities: Option, + #[serde(rename = "scaleInPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_in_policy: Option, + #[serde(rename = "orchestrationMode", default, skip_serializing_if = "Option::is_none")] + pub orchestration_mode: Option, + #[serde(rename = "spotRestorePolicy", default, skip_serializing_if = "Option::is_none")] + pub spot_restore_policy: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetPublicIpAddressConfiguration { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings { + #[serde(rename = "domainNameLabel")] + pub domain_name_label: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetPublicIpAddressConfigurationProperties { + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[serde(rename = "ipTags", default, skip_serializing_if = "Vec::is_empty")] + pub ip_tags: Vec, + #[serde(rename = "publicIPPrefix", default, skip_serializing_if = "Option::is_none")] + pub public_ip_prefix: Option, + #[serde(rename = "publicIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_version: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, +} +pub mod virtual_machine_scale_set_public_ip_address_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicIpAddressVersion { + IPv4, + IPv6, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteOption { + Delete, + Detach, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetReimageParameters { + #[serde(flatten)] + pub virtual_machine_scale_set_vm_reimage_parameters: VirtualMachineScaleSetVmReimageParameters, + #[serde(rename = "instanceIds", default, skip_serializing_if = "Vec::is_empty")] + pub instance_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetSku { + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetSkuCapacity { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minimum: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maximum: Option, + #[serde(rename = "defaultCapacity", default, skip_serializing_if = "Option::is_none")] + pub default_capacity: Option, + #[serde(rename = "scaleType", default, skip_serializing_if = "Option::is_none")] + pub scale_type: Option, +} +pub mod virtual_machine_scale_set_sku_capacity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScaleType { + Automatic, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetStorageProfile { + #[serde(rename = "imageReference", default, skip_serializing_if = "Option::is_none")] + pub image_reference: Option, + #[serde(rename = "osDisk", default, skip_serializing_if = "Option::is_none")] + pub os_disk: Option, + #[serde(rename = "dataDisks", default, skip_serializing_if = "Vec::is_empty")] + pub data_disks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub plan: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateIpConfigurationProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "publicIPAddressConfiguration", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_configuration: Option, + #[serde(rename = "privateIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address_version: Option, + #[serde(rename = "applicationGatewayBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub application_gateway_backend_address_pools: Vec, + #[serde(rename = "applicationSecurityGroups", default, skip_serializing_if = "Vec::is_empty")] + pub application_security_groups: Vec, + #[serde(rename = "loadBalancerBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_backend_address_pools: Vec, + #[serde(rename = "loadBalancerInboundNatPools", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_inbound_nat_pools: Vec, +} +pub mod virtual_machine_scale_set_update_ip_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateIpAddressVersion { + IPv4, + IPv6, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateNetworkConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateNetworkConfigurationProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "enableAcceleratedNetworking", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking: Option, + #[serde(rename = "enableFpga", default, skip_serializing_if = "Option::is_none")] + pub enable_fpga: Option, + #[serde(rename = "networkSecurityGroup", default, skip_serializing_if = "Option::is_none")] + pub network_security_group: Option, + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[serde(rename = "enableIPForwarding", default, skip_serializing_if = "Option::is_none")] + pub enable_ip_forwarding: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, +} +pub mod virtual_machine_scale_set_update_network_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteOption { + Delete, + Detach, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateNetworkProfile { + #[serde(rename = "healthProbe", default, skip_serializing_if = "Option::is_none")] + pub health_probe: Option, + #[serde(rename = "networkInterfaceConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub network_interface_configurations: Vec, + #[serde(rename = "networkApiVersion", default, skip_serializing_if = "Option::is_none")] + pub network_api_version: Option, +} +pub mod virtual_machine_scale_set_update_network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkApiVersion { + #[serde(rename = "2020-11-01")] + N2020_11_01, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateOsDisk { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub caching: Option, + #[serde(rename = "writeAcceleratorEnabled", default, skip_serializing_if = "Option::is_none")] + pub write_accelerator_enabled: Option, + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub image: Option, + #[serde(rename = "vhdContainers", default, skip_serializing_if = "Vec::is_empty")] + pub vhd_containers: Vec, + #[serde(rename = "managedDisk", default, skip_serializing_if = "Option::is_none")] + pub managed_disk: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateOsProfile { + #[serde(rename = "customData", default, skip_serializing_if = "Option::is_none")] + pub custom_data: Option, + #[serde(rename = "windowsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub windows_configuration: Option, + #[serde(rename = "linuxConfiguration", default, skip_serializing_if = "Option::is_none")] + pub linux_configuration: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub secrets: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateProperties { + #[serde(rename = "upgradePolicy", default, skip_serializing_if = "Option::is_none")] + pub upgrade_policy: Option, + #[serde(rename = "automaticRepairsPolicy", default, skip_serializing_if = "Option::is_none")] + pub automatic_repairs_policy: Option, + #[serde(rename = "virtualMachineProfile", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub overprovision: Option, + #[serde( + rename = "doNotRunExtensionsOnOverprovisionedVMs", + default, + skip_serializing_if = "Option::is_none" + )] + pub do_not_run_extensions_on_overprovisioned_v_ms: Option, + #[serde(rename = "singlePlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub single_placement_group: Option, + #[serde(rename = "additionalCapabilities", default, skip_serializing_if = "Option::is_none")] + pub additional_capabilities: Option, + #[serde(rename = "scaleInPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_in_policy: Option, + #[serde(rename = "proximityPlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdatePublicIpAddressConfiguration { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties { + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, +} +pub mod virtual_machine_scale_set_update_public_ip_address_configuration_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteOption { + Delete, + Detach, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateStorageProfile { + #[serde(rename = "imageReference", default, skip_serializing_if = "Option::is_none")] + pub image_reference: Option, + #[serde(rename = "osDisk", default, skip_serializing_if = "Option::is_none")] + pub os_disk: Option, + #[serde(rename = "dataDisks", default, skip_serializing_if = "Vec::is_empty")] + pub data_disks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetUpdateVmProfile { + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "diagnosticsProfile", default, skip_serializing_if = "Option::is_none")] + pub diagnostics_profile: Option, + #[serde(rename = "extensionProfile", default, skip_serializing_if = "Option::is_none")] + pub extension_profile: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "billingProfile", default, skip_serializing_if = "Option::is_none")] + pub billing_profile: Option, + #[serde(rename = "scheduledEventsProfile", default, skip_serializing_if = "Option::is_none")] + pub scheduled_events_profile: Option, + #[serde(rename = "userData", default, skip_serializing_if = "Option::is_none")] + pub user_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVm { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "instanceId", default, skip_serializing_if = "Option::is_none")] + pub instance_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub plan: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmExtension { + #[serde(flatten)] + pub sub_resource_read_only: SubResourceReadOnly, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmExtensionUpdate { + #[serde(flatten)] + pub sub_resource_read_only: SubResourceReadOnly, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmExtensionsListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmExtensionsSummary { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "statusesSummary", default, skip_serializing_if = "Vec::is_empty")] + pub statuses_summary: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmInstanceIDs { + #[serde(rename = "instanceIds", default, skip_serializing_if = "Vec::is_empty")] + pub instance_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmInstanceRequiredIDs { + #[serde(rename = "instanceIds")] + pub instance_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmInstanceView { + #[serde(rename = "platformUpdateDomain", default, skip_serializing_if = "Option::is_none")] + pub platform_update_domain: Option, + #[serde(rename = "platformFaultDomain", default, skip_serializing_if = "Option::is_none")] + pub platform_fault_domain: Option, + #[serde(rename = "rdpThumbPrint", default, skip_serializing_if = "Option::is_none")] + pub rdp_thumb_print: Option, + #[serde(rename = "vmAgent", default, skip_serializing_if = "Option::is_none")] + pub vm_agent: Option, + #[serde(rename = "maintenanceRedeployStatus", default, skip_serializing_if = "Option::is_none")] + pub maintenance_redeploy_status: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub extensions: Vec, + #[serde(rename = "vmHealth", default, skip_serializing_if = "Option::is_none")] + pub vm_health: Option, + #[serde(rename = "bootDiagnostics", default, skip_serializing_if = "Option::is_none")] + pub boot_diagnostics: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, + #[serde(rename = "assignedHost", default, skip_serializing_if = "Option::is_none")] + pub assigned_host: Option, + #[serde(rename = "placementGroupId", default, skip_serializing_if = "Option::is_none")] + pub placement_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmNetworkProfileConfiguration { + #[serde(rename = "networkInterfaceConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub network_interface_configurations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmProfile { + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "diagnosticsProfile", default, skip_serializing_if = "Option::is_none")] + pub diagnostics_profile: Option, + #[serde(rename = "extensionProfile", default, skip_serializing_if = "Option::is_none")] + pub extension_profile: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(rename = "evictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub eviction_policy: Option, + #[serde(rename = "billingProfile", default, skip_serializing_if = "Option::is_none")] + pub billing_profile: Option, + #[serde(rename = "scheduledEventsProfile", default, skip_serializing_if = "Option::is_none")] + pub scheduled_events_profile: Option, + #[serde(rename = "userData", default, skip_serializing_if = "Option::is_none")] + pub user_data: Option, + #[serde(rename = "capacityReservation", default, skip_serializing_if = "Option::is_none")] + pub capacity_reservation: Option, + #[serde(rename = "applicationProfile", default, skip_serializing_if = "Option::is_none")] + pub application_profile: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmProperties { + #[serde(rename = "latestModelApplied", default, skip_serializing_if = "Option::is_none")] + pub latest_model_applied: Option, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, + #[serde(rename = "hardwareProfile", default, skip_serializing_if = "Option::is_none")] + pub hardware_profile: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(rename = "additionalCapabilities", default, skip_serializing_if = "Option::is_none")] + pub additional_capabilities: Option, + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "networkProfileConfiguration", default, skip_serializing_if = "Option::is_none")] + pub network_profile_configuration: Option, + #[serde(rename = "diagnosticsProfile", default, skip_serializing_if = "Option::is_none")] + pub diagnostics_profile: Option, + #[serde(rename = "availabilitySet", default, skip_serializing_if = "Option::is_none")] + pub availability_set: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "modelDefinitionApplied", default, skip_serializing_if = "Option::is_none")] + pub model_definition_applied: Option, + #[serde(rename = "protectionPolicy", default, skip_serializing_if = "Option::is_none")] + pub protection_policy: Option, + #[serde(rename = "userData", default, skip_serializing_if = "Option::is_none")] + pub user_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmProtectionPolicy { + #[serde(rename = "protectFromScaleIn", default, skip_serializing_if = "Option::is_none")] + pub protect_from_scale_in: Option, + #[serde(rename = "protectFromScaleSetActions", default, skip_serializing_if = "Option::is_none")] + pub protect_from_scale_set_actions: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineScaleSetVmReimageParameters { + #[serde(flatten)] + pub virtual_machine_reimage_parameters: VirtualMachineReimageParameters, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineSize { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "numberOfCores", default, skip_serializing_if = "Option::is_none")] + pub number_of_cores: Option, + #[serde(rename = "osDiskSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_in_mb: Option, + #[serde(rename = "resourceDiskSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub resource_disk_size_in_mb: Option, + #[serde(rename = "memoryInMB", default, skip_serializing_if = "Option::is_none")] + pub memory_in_mb: Option, + #[serde(rename = "maxDataDiskCount", default, skip_serializing_if = "Option::is_none")] + pub max_data_disk_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineSizeListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineSoftwarePatchProperties { + #[serde(rename = "patchId", default, skip_serializing_if = "Option::is_none")] + pub patch_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "kbId", default, skip_serializing_if = "Option::is_none")] + pub kb_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[serde(rename = "rebootBehavior", default, skip_serializing_if = "Option::is_none")] + pub reboot_behavior: Option, + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, + #[serde(rename = "publishedDate", default, skip_serializing_if = "Option::is_none")] + pub published_date: Option, + #[serde(rename = "lastModifiedDateTime", default, skip_serializing_if = "Option::is_none")] + pub last_modified_date_time: Option, + #[serde(rename = "assessmentState", default, skip_serializing_if = "Option::is_none")] + pub assessment_state: Option, +} +pub mod virtual_machine_software_patch_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RebootBehavior { + Unknown, + NeverReboots, + AlwaysRequiresReboot, + CanRequestReboot, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AssessmentState { + Unknown, + Available, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineStatusCodeCount { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineUpdate { + #[serde(flatten)] + pub update_resource: UpdateResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub plan: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WinRmConfiguration { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub listeners: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WinRmListener { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[serde(rename = "certificateUrl", default, skip_serializing_if = "Option::is_none")] + pub certificate_url: Option, +} +pub mod win_rm_listener { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + Http, + Https, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WindowsConfiguration { + #[serde(rename = "provisionVMAgent", default, skip_serializing_if = "Option::is_none")] + pub provision_vm_agent: Option, + #[serde(rename = "enableAutomaticUpdates", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_updates: Option, + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[serde(rename = "additionalUnattendContent", default, skip_serializing_if = "Vec::is_empty")] + pub additional_unattend_content: Vec, + #[serde(rename = "patchSettings", default, skip_serializing_if = "Option::is_none")] + pub patch_settings: Option, + #[serde(rename = "winRM", default, skip_serializing_if = "Option::is_none")] + pub win_rm: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WindowsParameters { + #[serde(rename = "classificationsToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub classifications_to_include: Vec, + #[serde(rename = "kbNumbersToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub kb_numbers_to_include: Vec, + #[serde(rename = "kbNumbersToExclude", default, skip_serializing_if = "Vec::is_empty")] + pub kb_numbers_to_exclude: Vec, + #[serde(rename = "excludeKbsRequiringReboot", default, skip_serializing_if = "Option::is_none")] + pub exclude_kbs_requiring_reboot: Option, + #[serde(rename = "maxPatchPublishDate", default, skip_serializing_if = "Option::is_none")] + pub max_patch_publish_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EvictionPolicy { + Deallocate, + Delete, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Priority { + Regular, + Low, + Spot, +} diff --git a/services/mgmt/compute/src/package_2021_08_01/operations.rs b/services/mgmt/compute/src/package_2021_08_01/operations.rs new file mode 100644 index 0000000000..a210a846af --- /dev/null +++ b/services/mgmt/compute/src/package_2021_08_01/operations.rs @@ -0,0 +1,26613 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn availability_sets(&self) -> availability_sets::Client { + availability_sets::Client(self.clone()) + } + pub fn capacity_reservation_groups(&self) -> capacity_reservation_groups::Client { + capacity_reservation_groups::Client(self.clone()) + } + pub fn capacity_reservations(&self) -> capacity_reservations::Client { + capacity_reservations::Client(self.clone()) + } + pub fn cloud_service_operating_systems(&self) -> cloud_service_operating_systems::Client { + cloud_service_operating_systems::Client(self.clone()) + } + pub fn cloud_service_role_instances(&self) -> cloud_service_role_instances::Client { + cloud_service_role_instances::Client(self.clone()) + } + pub fn cloud_service_roles(&self) -> cloud_service_roles::Client { + cloud_service_roles::Client(self.clone()) + } + pub fn cloud_services(&self) -> cloud_services::Client { + cloud_services::Client(self.clone()) + } + pub fn cloud_services_update_domain(&self) -> cloud_services_update_domain::Client { + cloud_services_update_domain::Client(self.clone()) + } + pub fn community_galleries(&self) -> community_galleries::Client { + community_galleries::Client(self.clone()) + } + pub fn community_gallery_image_versions(&self) -> community_gallery_image_versions::Client { + community_gallery_image_versions::Client(self.clone()) + } + pub fn community_gallery_images(&self) -> community_gallery_images::Client { + community_gallery_images::Client(self.clone()) + } + pub fn dedicated_host_groups(&self) -> dedicated_host_groups::Client { + dedicated_host_groups::Client(self.clone()) + } + pub fn dedicated_hosts(&self) -> dedicated_hosts::Client { + dedicated_hosts::Client(self.clone()) + } + pub fn disk_accesses(&self) -> disk_accesses::Client { + disk_accesses::Client(self.clone()) + } + pub fn disk_encryption_sets(&self) -> disk_encryption_sets::Client { + disk_encryption_sets::Client(self.clone()) + } + pub fn disk_restore_point(&self) -> disk_restore_point::Client { + disk_restore_point::Client(self.clone()) + } + pub fn disks(&self) -> disks::Client { + disks::Client(self.clone()) + } + pub fn galleries(&self) -> galleries::Client { + galleries::Client(self.clone()) + } + pub fn gallery_application_versions(&self) -> gallery_application_versions::Client { + gallery_application_versions::Client(self.clone()) + } + pub fn gallery_applications(&self) -> gallery_applications::Client { + gallery_applications::Client(self.clone()) + } + pub fn gallery_image_versions(&self) -> gallery_image_versions::Client { + gallery_image_versions::Client(self.clone()) + } + pub fn gallery_images(&self) -> gallery_images::Client { + gallery_images::Client(self.clone()) + } + pub fn gallery_sharing_profile(&self) -> gallery_sharing_profile::Client { + gallery_sharing_profile::Client(self.clone()) + } + pub fn images(&self) -> images::Client { + images::Client(self.clone()) + } + pub fn log_analytics(&self) -> log_analytics::Client { + log_analytics::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn proximity_placement_groups(&self) -> proximity_placement_groups::Client { + proximity_placement_groups::Client(self.clone()) + } + pub fn resource_skus(&self) -> resource_skus::Client { + resource_skus::Client(self.clone()) + } + pub fn restore_point_collections(&self) -> restore_point_collections::Client { + restore_point_collections::Client(self.clone()) + } + pub fn restore_points(&self) -> restore_points::Client { + restore_points::Client(self.clone()) + } + pub fn shared_galleries(&self) -> shared_galleries::Client { + shared_galleries::Client(self.clone()) + } + pub fn shared_gallery_image_versions(&self) -> shared_gallery_image_versions::Client { + shared_gallery_image_versions::Client(self.clone()) + } + pub fn shared_gallery_images(&self) -> shared_gallery_images::Client { + shared_gallery_images::Client(self.clone()) + } + pub fn snapshots(&self) -> snapshots::Client { + snapshots::Client(self.clone()) + } + pub fn ssh_public_keys(&self) -> ssh_public_keys::Client { + ssh_public_keys::Client(self.clone()) + } + pub fn usage(&self) -> usage::Client { + usage::Client(self.clone()) + } + pub fn virtual_machine_extension_images(&self) -> virtual_machine_extension_images::Client { + virtual_machine_extension_images::Client(self.clone()) + } + pub fn virtual_machine_extensions(&self) -> virtual_machine_extensions::Client { + virtual_machine_extensions::Client(self.clone()) + } + pub fn virtual_machine_images(&self) -> virtual_machine_images::Client { + virtual_machine_images::Client(self.clone()) + } + pub fn virtual_machine_images_edge_zone(&self) -> virtual_machine_images_edge_zone::Client { + virtual_machine_images_edge_zone::Client(self.clone()) + } + pub fn virtual_machine_run_commands(&self) -> virtual_machine_run_commands::Client { + virtual_machine_run_commands::Client(self.clone()) + } + pub fn virtual_machine_scale_set_extensions(&self) -> virtual_machine_scale_set_extensions::Client { + virtual_machine_scale_set_extensions::Client(self.clone()) + } + pub fn virtual_machine_scale_set_rolling_upgrades(&self) -> virtual_machine_scale_set_rolling_upgrades::Client { + virtual_machine_scale_set_rolling_upgrades::Client(self.clone()) + } + pub fn virtual_machine_scale_set_v_ms(&self) -> virtual_machine_scale_set_v_ms::Client { + virtual_machine_scale_set_v_ms::Client(self.clone()) + } + pub fn virtual_machine_scale_set_vm_extensions(&self) -> virtual_machine_scale_set_vm_extensions::Client { + virtual_machine_scale_set_vm_extensions::Client(self.clone()) + } + pub fn virtual_machine_scale_set_vm_run_commands(&self) -> virtual_machine_scale_set_vm_run_commands::Client { + virtual_machine_scale_set_vm_run_commands::Client(self.clone()) + } + pub fn virtual_machine_scale_sets(&self) -> virtual_machine_scale_sets::Client { + virtual_machine_scale_sets::Client(self.clone()) + } + pub fn virtual_machine_sizes(&self) -> virtual_machine_sizes::Client { + virtual_machine_sizes::Client(self.clone()) + } + pub fn virtual_machines(&self) -> virtual_machines::Client { + virtual_machines::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + AvailabilitySets_Get(#[from] availability_sets::get::Error), + #[error(transparent)] + AvailabilitySets_CreateOrUpdate(#[from] availability_sets::create_or_update::Error), + #[error(transparent)] + AvailabilitySets_Update(#[from] availability_sets::update::Error), + #[error(transparent)] + AvailabilitySets_Delete(#[from] availability_sets::delete::Error), + #[error(transparent)] + AvailabilitySets_ListBySubscription(#[from] availability_sets::list_by_subscription::Error), + #[error(transparent)] + AvailabilitySets_List(#[from] availability_sets::list::Error), + #[error(transparent)] + AvailabilitySets_ListAvailableSizes(#[from] availability_sets::list_available_sizes::Error), + #[error(transparent)] + ProximityPlacementGroups_Get(#[from] proximity_placement_groups::get::Error), + #[error(transparent)] + ProximityPlacementGroups_CreateOrUpdate(#[from] proximity_placement_groups::create_or_update::Error), + #[error(transparent)] + ProximityPlacementGroups_Update(#[from] proximity_placement_groups::update::Error), + #[error(transparent)] + ProximityPlacementGroups_Delete(#[from] proximity_placement_groups::delete::Error), + #[error(transparent)] + ProximityPlacementGroups_ListBySubscription(#[from] proximity_placement_groups::list_by_subscription::Error), + #[error(transparent)] + ProximityPlacementGroups_ListByResourceGroup(#[from] proximity_placement_groups::list_by_resource_group::Error), + #[error(transparent)] + DedicatedHostGroups_Get(#[from] dedicated_host_groups::get::Error), + #[error(transparent)] + DedicatedHostGroups_CreateOrUpdate(#[from] dedicated_host_groups::create_or_update::Error), + #[error(transparent)] + DedicatedHostGroups_Update(#[from] dedicated_host_groups::update::Error), + #[error(transparent)] + DedicatedHostGroups_Delete(#[from] dedicated_host_groups::delete::Error), + #[error(transparent)] + DedicatedHostGroups_ListByResourceGroup(#[from] dedicated_host_groups::list_by_resource_group::Error), + #[error(transparent)] + DedicatedHostGroups_ListBySubscription(#[from] dedicated_host_groups::list_by_subscription::Error), + #[error(transparent)] + DedicatedHosts_Get(#[from] dedicated_hosts::get::Error), + #[error(transparent)] + DedicatedHosts_CreateOrUpdate(#[from] dedicated_hosts::create_or_update::Error), + #[error(transparent)] + DedicatedHosts_Update(#[from] dedicated_hosts::update::Error), + #[error(transparent)] + DedicatedHosts_Delete(#[from] dedicated_hosts::delete::Error), + #[error(transparent)] + DedicatedHosts_ListByHostGroup(#[from] dedicated_hosts::list_by_host_group::Error), + #[error(transparent)] + SshPublicKeys_ListBySubscription(#[from] ssh_public_keys::list_by_subscription::Error), + #[error(transparent)] + SshPublicKeys_ListByResourceGroup(#[from] ssh_public_keys::list_by_resource_group::Error), + #[error(transparent)] + SshPublicKeys_Get(#[from] ssh_public_keys::get::Error), + #[error(transparent)] + SshPublicKeys_Create(#[from] ssh_public_keys::create::Error), + #[error(transparent)] + SshPublicKeys_Update(#[from] ssh_public_keys::update::Error), + #[error(transparent)] + SshPublicKeys_Delete(#[from] ssh_public_keys::delete::Error), + #[error(transparent)] + SshPublicKeys_GenerateKeyPair(#[from] ssh_public_keys::generate_key_pair::Error), + #[error(transparent)] + VirtualMachineExtensionImages_Get(#[from] virtual_machine_extension_images::get::Error), + #[error(transparent)] + VirtualMachineExtensionImages_ListTypes(#[from] virtual_machine_extension_images::list_types::Error), + #[error(transparent)] + VirtualMachineExtensionImages_ListVersions(#[from] virtual_machine_extension_images::list_versions::Error), + #[error(transparent)] + VirtualMachineExtensions_Get(#[from] virtual_machine_extensions::get::Error), + #[error(transparent)] + VirtualMachineExtensions_CreateOrUpdate(#[from] virtual_machine_extensions::create_or_update::Error), + #[error(transparent)] + VirtualMachineExtensions_Update(#[from] virtual_machine_extensions::update::Error), + #[error(transparent)] + VirtualMachineExtensions_Delete(#[from] virtual_machine_extensions::delete::Error), + #[error(transparent)] + VirtualMachineExtensions_List(#[from] virtual_machine_extensions::list::Error), + #[error(transparent)] + VirtualMachineImages_Get(#[from] virtual_machine_images::get::Error), + #[error(transparent)] + VirtualMachineImages_List(#[from] virtual_machine_images::list::Error), + #[error(transparent)] + VirtualMachineImages_ListOffers(#[from] virtual_machine_images::list_offers::Error), + #[error(transparent)] + VirtualMachineImages_ListPublishers(#[from] virtual_machine_images::list_publishers::Error), + #[error(transparent)] + VirtualMachineImages_ListSkus(#[from] virtual_machine_images::list_skus::Error), + #[error(transparent)] + VirtualMachineImagesEdgeZone_Get(#[from] virtual_machine_images_edge_zone::get::Error), + #[error(transparent)] + VirtualMachineImagesEdgeZone_List(#[from] virtual_machine_images_edge_zone::list::Error), + #[error(transparent)] + VirtualMachineImagesEdgeZone_ListOffers(#[from] virtual_machine_images_edge_zone::list_offers::Error), + #[error(transparent)] + VirtualMachineImagesEdgeZone_ListPublishers(#[from] virtual_machine_images_edge_zone::list_publishers::Error), + #[error(transparent)] + VirtualMachineImagesEdgeZone_ListSkus(#[from] virtual_machine_images_edge_zone::list_skus::Error), + #[error(transparent)] + Usage_List(#[from] usage::list::Error), + #[error(transparent)] + VirtualMachines_ListByLocation(#[from] virtual_machines::list_by_location::Error), + #[error(transparent)] + VirtualMachineScaleSets_ListByLocation(#[from] virtual_machine_scale_sets::list_by_location::Error), + #[error(transparent)] + VirtualMachineSizes_List(#[from] virtual_machine_sizes::list::Error), + #[error(transparent)] + Images_Get(#[from] images::get::Error), + #[error(transparent)] + Images_CreateOrUpdate(#[from] images::create_or_update::Error), + #[error(transparent)] + Images_Update(#[from] images::update::Error), + #[error(transparent)] + Images_Delete(#[from] images::delete::Error), + #[error(transparent)] + Images_ListByResourceGroup(#[from] images::list_by_resource_group::Error), + #[error(transparent)] + Images_List(#[from] images::list::Error), + #[error(transparent)] + VirtualMachines_Capture(#[from] virtual_machines::capture::Error), + #[error(transparent)] + VirtualMachines_Get(#[from] virtual_machines::get::Error), + #[error(transparent)] + VirtualMachines_CreateOrUpdate(#[from] virtual_machines::create_or_update::Error), + #[error(transparent)] + VirtualMachines_Update(#[from] virtual_machines::update::Error), + #[error(transparent)] + VirtualMachines_Delete(#[from] virtual_machines::delete::Error), + #[error(transparent)] + VirtualMachines_InstanceView(#[from] virtual_machines::instance_view::Error), + #[error(transparent)] + VirtualMachines_ConvertToManagedDisks(#[from] virtual_machines::convert_to_managed_disks::Error), + #[error(transparent)] + VirtualMachines_Deallocate(#[from] virtual_machines::deallocate::Error), + #[error(transparent)] + VirtualMachines_Generalize(#[from] virtual_machines::generalize::Error), + #[error(transparent)] + VirtualMachines_List(#[from] virtual_machines::list::Error), + #[error(transparent)] + VirtualMachines_ListAll(#[from] virtual_machines::list_all::Error), + #[error(transparent)] + RestorePointCollections_Get(#[from] restore_point_collections::get::Error), + #[error(transparent)] + RestorePointCollections_CreateOrUpdate(#[from] restore_point_collections::create_or_update::Error), + #[error(transparent)] + RestorePointCollections_Update(#[from] restore_point_collections::update::Error), + #[error(transparent)] + RestorePointCollections_Delete(#[from] restore_point_collections::delete::Error), + #[error(transparent)] + RestorePointCollections_List(#[from] restore_point_collections::list::Error), + #[error(transparent)] + RestorePointCollections_ListAll(#[from] restore_point_collections::list_all::Error), + #[error(transparent)] + RestorePoints_Get(#[from] restore_points::get::Error), + #[error(transparent)] + RestorePoints_Create(#[from] restore_points::create::Error), + #[error(transparent)] + RestorePoints_Delete(#[from] restore_points::delete::Error), + #[error(transparent)] + VirtualMachines_ListAvailableSizes(#[from] virtual_machines::list_available_sizes::Error), + #[error(transparent)] + CapacityReservationGroups_Get(#[from] capacity_reservation_groups::get::Error), + #[error(transparent)] + CapacityReservationGroups_CreateOrUpdate(#[from] capacity_reservation_groups::create_or_update::Error), + #[error(transparent)] + CapacityReservationGroups_Update(#[from] capacity_reservation_groups::update::Error), + #[error(transparent)] + CapacityReservationGroups_Delete(#[from] capacity_reservation_groups::delete::Error), + #[error(transparent)] + CapacityReservationGroups_ListByResourceGroup(#[from] capacity_reservation_groups::list_by_resource_group::Error), + #[error(transparent)] + CapacityReservationGroups_ListBySubscription(#[from] capacity_reservation_groups::list_by_subscription::Error), + #[error(transparent)] + CapacityReservations_Get(#[from] capacity_reservations::get::Error), + #[error(transparent)] + CapacityReservations_CreateOrUpdate(#[from] capacity_reservations::create_or_update::Error), + #[error(transparent)] + CapacityReservations_Update(#[from] capacity_reservations::update::Error), + #[error(transparent)] + CapacityReservations_Delete(#[from] capacity_reservations::delete::Error), + #[error(transparent)] + CapacityReservations_ListByCapacityReservationGroup(#[from] capacity_reservations::list_by_capacity_reservation_group::Error), + #[error(transparent)] + VirtualMachines_PowerOff(#[from] virtual_machines::power_off::Error), + #[error(transparent)] + VirtualMachines_Reapply(#[from] virtual_machines::reapply::Error), + #[error(transparent)] + VirtualMachines_Restart(#[from] virtual_machines::restart::Error), + #[error(transparent)] + VirtualMachines_Start(#[from] virtual_machines::start::Error), + #[error(transparent)] + VirtualMachines_Redeploy(#[from] virtual_machines::redeploy::Error), + #[error(transparent)] + VirtualMachines_Reimage(#[from] virtual_machines::reimage::Error), + #[error(transparent)] + VirtualMachines_RetrieveBootDiagnosticsData(#[from] virtual_machines::retrieve_boot_diagnostics_data::Error), + #[error(transparent)] + VirtualMachines_PerformMaintenance(#[from] virtual_machines::perform_maintenance::Error), + #[error(transparent)] + VirtualMachines_SimulateEviction(#[from] virtual_machines::simulate_eviction::Error), + #[error(transparent)] + VirtualMachines_AssessPatches(#[from] virtual_machines::assess_patches::Error), + #[error(transparent)] + VirtualMachines_InstallPatches(#[from] virtual_machines::install_patches::Error), + #[error(transparent)] + VirtualMachineScaleSets_Get(#[from] virtual_machine_scale_sets::get::Error), + #[error(transparent)] + VirtualMachineScaleSets_CreateOrUpdate(#[from] virtual_machine_scale_sets::create_or_update::Error), + #[error(transparent)] + VirtualMachineScaleSets_Update(#[from] virtual_machine_scale_sets::update::Error), + #[error(transparent)] + VirtualMachineScaleSets_Delete(#[from] virtual_machine_scale_sets::delete::Error), + #[error(transparent)] + VirtualMachineScaleSets_Deallocate(#[from] virtual_machine_scale_sets::deallocate::Error), + #[error(transparent)] + VirtualMachineScaleSets_DeleteInstances(#[from] virtual_machine_scale_sets::delete_instances::Error), + #[error(transparent)] + VirtualMachineScaleSets_GetInstanceView(#[from] virtual_machine_scale_sets::get_instance_view::Error), + #[error(transparent)] + VirtualMachineScaleSets_List(#[from] virtual_machine_scale_sets::list::Error), + #[error(transparent)] + VirtualMachineScaleSetExtensions_Get(#[from] virtual_machine_scale_set_extensions::get::Error), + #[error(transparent)] + VirtualMachineScaleSetExtensions_CreateOrUpdate(#[from] virtual_machine_scale_set_extensions::create_or_update::Error), + #[error(transparent)] + VirtualMachineScaleSetExtensions_Update(#[from] virtual_machine_scale_set_extensions::update::Error), + #[error(transparent)] + VirtualMachineScaleSetExtensions_Delete(#[from] virtual_machine_scale_set_extensions::delete::Error), + #[error(transparent)] + VirtualMachineScaleSetExtensions_List(#[from] virtual_machine_scale_set_extensions::list::Error), + #[error(transparent)] + VirtualMachineScaleSets_ListAll(#[from] virtual_machine_scale_sets::list_all::Error), + #[error(transparent)] + VirtualMachineScaleSets_ListSkus(#[from] virtual_machine_scale_sets::list_skus::Error), + #[error(transparent)] + VirtualMachineScaleSets_GetOsUpgradeHistory(#[from] virtual_machine_scale_sets::get_os_upgrade_history::Error), + #[error(transparent)] + VirtualMachineScaleSets_PowerOff(#[from] virtual_machine_scale_sets::power_off::Error), + #[error(transparent)] + VirtualMachineScaleSets_Restart(#[from] virtual_machine_scale_sets::restart::Error), + #[error(transparent)] + VirtualMachineScaleSets_Start(#[from] virtual_machine_scale_sets::start::Error), + #[error(transparent)] + VirtualMachineScaleSets_Redeploy(#[from] virtual_machine_scale_sets::redeploy::Error), + #[error(transparent)] + VirtualMachineScaleSets_PerformMaintenance(#[from] virtual_machine_scale_sets::perform_maintenance::Error), + #[error(transparent)] + VirtualMachineScaleSets_UpdateInstances(#[from] virtual_machine_scale_sets::update_instances::Error), + #[error(transparent)] + VirtualMachineScaleSets_Reimage(#[from] virtual_machine_scale_sets::reimage::Error), + #[error(transparent)] + VirtualMachineScaleSets_ReimageAll(#[from] virtual_machine_scale_sets::reimage_all::Error), + #[error(transparent)] + VirtualMachineScaleSetRollingUpgrades_Cancel(#[from] virtual_machine_scale_set_rolling_upgrades::cancel::Error), + #[error(transparent)] + VirtualMachineScaleSetRollingUpgrades_StartOsUpgrade(#[from] virtual_machine_scale_set_rolling_upgrades::start_os_upgrade::Error), + #[error(transparent)] + VirtualMachineScaleSetRollingUpgrades_StartExtensionUpgrade( + #[from] virtual_machine_scale_set_rolling_upgrades::start_extension_upgrade::Error, + ), + #[error(transparent)] + VirtualMachineScaleSetRollingUpgrades_GetLatest(#[from] virtual_machine_scale_set_rolling_upgrades::get_latest::Error), + #[error(transparent)] + VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk( + #[from] virtual_machine_scale_sets::force_recovery_service_fabric_platform_update_domain_walk::Error, + ), + #[error(transparent)] + VirtualMachineScaleSets_ConvertToSinglePlacementGroup(#[from] virtual_machine_scale_sets::convert_to_single_placement_group::Error), + #[error(transparent)] + VirtualMachineScaleSets_SetOrchestrationServiceState(#[from] virtual_machine_scale_sets::set_orchestration_service_state::Error), + #[error(transparent)] + VirtualMachineScaleSetVmExtensions_Get(#[from] virtual_machine_scale_set_vm_extensions::get::Error), + #[error(transparent)] + VirtualMachineScaleSetVmExtensions_CreateOrUpdate(#[from] virtual_machine_scale_set_vm_extensions::create_or_update::Error), + #[error(transparent)] + VirtualMachineScaleSetVmExtensions_Update(#[from] virtual_machine_scale_set_vm_extensions::update::Error), + #[error(transparent)] + VirtualMachineScaleSetVmExtensions_Delete(#[from] virtual_machine_scale_set_vm_extensions::delete::Error), + #[error(transparent)] + VirtualMachineScaleSetVmExtensions_List(#[from] virtual_machine_scale_set_vm_extensions::list::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_Reimage(#[from] virtual_machine_scale_set_v_ms::reimage::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_ReimageAll(#[from] virtual_machine_scale_set_v_ms::reimage_all::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_Deallocate(#[from] virtual_machine_scale_set_v_ms::deallocate::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_Get(#[from] virtual_machine_scale_set_v_ms::get::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_Update(#[from] virtual_machine_scale_set_v_ms::update::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_Delete(#[from] virtual_machine_scale_set_v_ms::delete::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_GetInstanceView(#[from] virtual_machine_scale_set_v_ms::get_instance_view::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_List(#[from] virtual_machine_scale_set_v_ms::list::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_PowerOff(#[from] virtual_machine_scale_set_v_ms::power_off::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_Restart(#[from] virtual_machine_scale_set_v_ms::restart::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_Start(#[from] virtual_machine_scale_set_v_ms::start::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_Redeploy(#[from] virtual_machine_scale_set_v_ms::redeploy::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_RetrieveBootDiagnosticsData(#[from] virtual_machine_scale_set_v_ms::retrieve_boot_diagnostics_data::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_PerformMaintenance(#[from] virtual_machine_scale_set_v_ms::perform_maintenance::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_SimulateEviction(#[from] virtual_machine_scale_set_v_ms::simulate_eviction::Error), + #[error(transparent)] + LogAnalytics_ExportRequestRateByInterval(#[from] log_analytics::export_request_rate_by_interval::Error), + #[error(transparent)] + LogAnalytics_ExportThrottledRequests(#[from] log_analytics::export_throttled_requests::Error), + #[error(transparent)] + VirtualMachineRunCommands_List(#[from] virtual_machine_run_commands::list::Error), + #[error(transparent)] + VirtualMachineRunCommands_Get(#[from] virtual_machine_run_commands::get::Error), + #[error(transparent)] + VirtualMachines_RunCommand(#[from] virtual_machines::run_command::Error), + #[error(transparent)] + VirtualMachineScaleSetVMs_RunCommand(#[from] virtual_machine_scale_set_v_ms::run_command::Error), + #[error(transparent)] + VirtualMachineRunCommands_GetByVirtualMachine(#[from] virtual_machine_run_commands::get_by_virtual_machine::Error), + #[error(transparent)] + VirtualMachineRunCommands_CreateOrUpdate(#[from] virtual_machine_run_commands::create_or_update::Error), + #[error(transparent)] + VirtualMachineRunCommands_Update(#[from] virtual_machine_run_commands::update::Error), + #[error(transparent)] + VirtualMachineRunCommands_Delete(#[from] virtual_machine_run_commands::delete::Error), + #[error(transparent)] + VirtualMachineRunCommands_ListByVirtualMachine(#[from] virtual_machine_run_commands::list_by_virtual_machine::Error), + #[error(transparent)] + VirtualMachineScaleSetVmRunCommands_Get(#[from] virtual_machine_scale_set_vm_run_commands::get::Error), + #[error(transparent)] + VirtualMachineScaleSetVmRunCommands_CreateOrUpdate(#[from] virtual_machine_scale_set_vm_run_commands::create_or_update::Error), + #[error(transparent)] + VirtualMachineScaleSetVmRunCommands_Update(#[from] virtual_machine_scale_set_vm_run_commands::update::Error), + #[error(transparent)] + VirtualMachineScaleSetVmRunCommands_Delete(#[from] virtual_machine_scale_set_vm_run_commands::delete::Error), + #[error(transparent)] + VirtualMachineScaleSetVmRunCommands_List(#[from] virtual_machine_scale_set_vm_run_commands::list::Error), + #[error(transparent)] + ResourceSkus_List(#[from] resource_skus::list::Error), + #[error(transparent)] + Disks_Get(#[from] disks::get::Error), + #[error(transparent)] + Disks_CreateOrUpdate(#[from] disks::create_or_update::Error), + #[error(transparent)] + Disks_Update(#[from] disks::update::Error), + #[error(transparent)] + Disks_Delete(#[from] disks::delete::Error), + #[error(transparent)] + Disks_ListByResourceGroup(#[from] disks::list_by_resource_group::Error), + #[error(transparent)] + Disks_List(#[from] disks::list::Error), + #[error(transparent)] + Disks_GrantAccess(#[from] disks::grant_access::Error), + #[error(transparent)] + Disks_RevokeAccess(#[from] disks::revoke_access::Error), + #[error(transparent)] + Snapshots_Get(#[from] snapshots::get::Error), + #[error(transparent)] + Snapshots_CreateOrUpdate(#[from] snapshots::create_or_update::Error), + #[error(transparent)] + Snapshots_Update(#[from] snapshots::update::Error), + #[error(transparent)] + Snapshots_Delete(#[from] snapshots::delete::Error), + #[error(transparent)] + Snapshots_ListByResourceGroup(#[from] snapshots::list_by_resource_group::Error), + #[error(transparent)] + Snapshots_List(#[from] snapshots::list::Error), + #[error(transparent)] + Snapshots_GrantAccess(#[from] snapshots::grant_access::Error), + #[error(transparent)] + Snapshots_RevokeAccess(#[from] snapshots::revoke_access::Error), + #[error(transparent)] + DiskEncryptionSets_Get(#[from] disk_encryption_sets::get::Error), + #[error(transparent)] + DiskEncryptionSets_CreateOrUpdate(#[from] disk_encryption_sets::create_or_update::Error), + #[error(transparent)] + DiskEncryptionSets_Update(#[from] disk_encryption_sets::update::Error), + #[error(transparent)] + DiskEncryptionSets_Delete(#[from] disk_encryption_sets::delete::Error), + #[error(transparent)] + DiskEncryptionSets_ListByResourceGroup(#[from] disk_encryption_sets::list_by_resource_group::Error), + #[error(transparent)] + DiskEncryptionSets_List(#[from] disk_encryption_sets::list::Error), + #[error(transparent)] + DiskEncryptionSets_ListAssociatedResources(#[from] disk_encryption_sets::list_associated_resources::Error), + #[error(transparent)] + DiskAccesses_Get(#[from] disk_accesses::get::Error), + #[error(transparent)] + DiskAccesses_CreateOrUpdate(#[from] disk_accesses::create_or_update::Error), + #[error(transparent)] + DiskAccesses_Update(#[from] disk_accesses::update::Error), + #[error(transparent)] + DiskAccesses_Delete(#[from] disk_accesses::delete::Error), + #[error(transparent)] + DiskAccesses_ListByResourceGroup(#[from] disk_accesses::list_by_resource_group::Error), + #[error(transparent)] + DiskAccesses_List(#[from] disk_accesses::list::Error), + #[error(transparent)] + DiskAccesses_GetPrivateLinkResources(#[from] disk_accesses::get_private_link_resources::Error), + #[error(transparent)] + DiskAccesses_GetAPrivateEndpointConnection(#[from] disk_accesses::get_a_private_endpoint_connection::Error), + #[error(transparent)] + DiskAccesses_UpdateAPrivateEndpointConnection(#[from] disk_accesses::update_a_private_endpoint_connection::Error), + #[error(transparent)] + DiskAccesses_DeleteAPrivateEndpointConnection(#[from] disk_accesses::delete_a_private_endpoint_connection::Error), + #[error(transparent)] + DiskAccesses_ListPrivateEndpointConnections(#[from] disk_accesses::list_private_endpoint_connections::Error), + #[error(transparent)] + DiskRestorePoint_Get(#[from] disk_restore_point::get::Error), + #[error(transparent)] + DiskRestorePoint_ListByRestorePoint(#[from] disk_restore_point::list_by_restore_point::Error), + #[error(transparent)] + DiskRestorePoint_GrantAccess(#[from] disk_restore_point::grant_access::Error), + #[error(transparent)] + DiskRestorePoint_RevokeAccess(#[from] disk_restore_point::revoke_access::Error), + #[error(transparent)] + Galleries_Get(#[from] galleries::get::Error), + #[error(transparent)] + Galleries_CreateOrUpdate(#[from] galleries::create_or_update::Error), + #[error(transparent)] + Galleries_Update(#[from] galleries::update::Error), + #[error(transparent)] + Galleries_Delete(#[from] galleries::delete::Error), + #[error(transparent)] + GalleryImages_Get(#[from] gallery_images::get::Error), + #[error(transparent)] + GalleryImages_CreateOrUpdate(#[from] gallery_images::create_or_update::Error), + #[error(transparent)] + GalleryImages_Update(#[from] gallery_images::update::Error), + #[error(transparent)] + GalleryImages_Delete(#[from] gallery_images::delete::Error), + #[error(transparent)] + GalleryImageVersions_Get(#[from] gallery_image_versions::get::Error), + #[error(transparent)] + GalleryImageVersions_CreateOrUpdate(#[from] gallery_image_versions::create_or_update::Error), + #[error(transparent)] + GalleryImageVersions_Update(#[from] gallery_image_versions::update::Error), + #[error(transparent)] + GalleryImageVersions_Delete(#[from] gallery_image_versions::delete::Error), + #[error(transparent)] + GalleryApplications_Get(#[from] gallery_applications::get::Error), + #[error(transparent)] + GalleryApplications_CreateOrUpdate(#[from] gallery_applications::create_or_update::Error), + #[error(transparent)] + GalleryApplications_Update(#[from] gallery_applications::update::Error), + #[error(transparent)] + GalleryApplications_Delete(#[from] gallery_applications::delete::Error), + #[error(transparent)] + GalleryApplicationVersions_Get(#[from] gallery_application_versions::get::Error), + #[error(transparent)] + GalleryApplicationVersions_CreateOrUpdate(#[from] gallery_application_versions::create_or_update::Error), + #[error(transparent)] + GalleryApplicationVersions_Update(#[from] gallery_application_versions::update::Error), + #[error(transparent)] + GalleryApplicationVersions_Delete(#[from] gallery_application_versions::delete::Error), + #[error(transparent)] + Galleries_ListByResourceGroup(#[from] galleries::list_by_resource_group::Error), + #[error(transparent)] + Galleries_List(#[from] galleries::list::Error), + #[error(transparent)] + GalleryImages_ListByGallery(#[from] gallery_images::list_by_gallery::Error), + #[error(transparent)] + GalleryImageVersions_ListByGalleryImage(#[from] gallery_image_versions::list_by_gallery_image::Error), + #[error(transparent)] + GalleryApplications_ListByGallery(#[from] gallery_applications::list_by_gallery::Error), + #[error(transparent)] + GalleryApplicationVersions_ListByGalleryApplication(#[from] gallery_application_versions::list_by_gallery_application::Error), + #[error(transparent)] + GallerySharingProfile_Update(#[from] gallery_sharing_profile::update::Error), + #[error(transparent)] + SharedGalleries_List(#[from] shared_galleries::list::Error), + #[error(transparent)] + SharedGalleryImages_List(#[from] shared_gallery_images::list::Error), + #[error(transparent)] + SharedGalleryImageVersions_List(#[from] shared_gallery_image_versions::list::Error), + #[error(transparent)] + SharedGalleries_Get(#[from] shared_galleries::get::Error), + #[error(transparent)] + SharedGalleryImages_Get(#[from] shared_gallery_images::get::Error), + #[error(transparent)] + SharedGalleryImageVersions_Get(#[from] shared_gallery_image_versions::get::Error), + #[error(transparent)] + CommunityGalleries_Get(#[from] community_galleries::get::Error), + #[error(transparent)] + CommunityGalleryImages_Get(#[from] community_gallery_images::get::Error), + #[error(transparent)] + CommunityGalleryImageVersions_Get(#[from] community_gallery_image_versions::get::Error), + #[error(transparent)] + CloudServiceRoleInstances_Get(#[from] cloud_service_role_instances::get::Error), + #[error(transparent)] + CloudServiceRoleInstances_Delete(#[from] cloud_service_role_instances::delete::Error), + #[error(transparent)] + CloudServiceRoleInstances_GetInstanceView(#[from] cloud_service_role_instances::get_instance_view::Error), + #[error(transparent)] + CloudServiceRoleInstances_List(#[from] cloud_service_role_instances::list::Error), + #[error(transparent)] + CloudServiceRoleInstances_Restart(#[from] cloud_service_role_instances::restart::Error), + #[error(transparent)] + CloudServiceRoleInstances_Reimage(#[from] cloud_service_role_instances::reimage::Error), + #[error(transparent)] + CloudServiceRoleInstances_Rebuild(#[from] cloud_service_role_instances::rebuild::Error), + #[error(transparent)] + CloudServiceRoleInstances_GetRemoteDesktopFile(#[from] cloud_service_role_instances::get_remote_desktop_file::Error), + #[error(transparent)] + CloudServiceRoles_Get(#[from] cloud_service_roles::get::Error), + #[error(transparent)] + CloudServiceRoles_List(#[from] cloud_service_roles::list::Error), + #[error(transparent)] + CloudServices_Get(#[from] cloud_services::get::Error), + #[error(transparent)] + CloudServices_CreateOrUpdate(#[from] cloud_services::create_or_update::Error), + #[error(transparent)] + CloudServices_Update(#[from] cloud_services::update::Error), + #[error(transparent)] + CloudServices_Delete(#[from] cloud_services::delete::Error), + #[error(transparent)] + CloudServices_GetInstanceView(#[from] cloud_services::get_instance_view::Error), + #[error(transparent)] + CloudServices_ListAll(#[from] cloud_services::list_all::Error), + #[error(transparent)] + CloudServices_List(#[from] cloud_services::list::Error), + #[error(transparent)] + CloudServices_Start(#[from] cloud_services::start::Error), + #[error(transparent)] + CloudServices_PowerOff(#[from] cloud_services::power_off::Error), + #[error(transparent)] + CloudServices_Restart(#[from] cloud_services::restart::Error), + #[error(transparent)] + CloudServices_Reimage(#[from] cloud_services::reimage::Error), + #[error(transparent)] + CloudServices_Rebuild(#[from] cloud_services::rebuild::Error), + #[error(transparent)] + CloudServices_DeleteInstances(#[from] cloud_services::delete_instances::Error), + #[error(transparent)] + CloudServicesUpdateDomain_GetUpdateDomain(#[from] cloud_services_update_domain::get_update_domain::Error), + #[error(transparent)] + CloudServicesUpdateDomain_WalkUpdateDomain(#[from] cloud_services_update_domain::walk_update_domain::Error), + #[error(transparent)] + CloudServicesUpdateDomain_ListUpdateDomains(#[from] cloud_services_update_domain::list_update_domains::Error), + #[error(transparent)] + CloudServiceOperatingSystems_GetOsVersion(#[from] cloud_service_operating_systems::get_os_version::Error), + #[error(transparent)] + CloudServiceOperatingSystems_ListOsVersions(#[from] cloud_service_operating_systems::list_os_versions::Error), + #[error(transparent)] + CloudServiceOperatingSystems_GetOsFamily(#[from] cloud_service_operating_systems::get_os_family::Error), + #[error(transparent)] + CloudServiceOperatingSystems_ListOsFamilies(#[from] cloud_service_operating_systems::list_os_families::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Compute/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ComputeOperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod availability_sets { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + availability_set_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + availability_set_name: availability_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + availability_set_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + availability_set_name: availability_set_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + availability_set_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + availability_set_name: availability_set_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + availability_set_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + availability_set_name: availability_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_available_sizes( + &self, + resource_group_name: impl Into, + availability_set_name: impl Into, + subscription_id: impl Into, + ) -> list_available_sizes::Builder { + list_available_sizes::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + availability_set_name: availability_set_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) availability_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/availabilitySets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) availability_set_name: String, + pub(crate) parameters: models::AvailabilitySet, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/availabilitySets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) availability_set_name: String, + pub(crate) parameters: models::AvailabilitySetUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/availabilitySets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) availability_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/availabilitySets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/availabilitySets", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySetListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/availabilitySets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySetListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_available_sizes { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) availability_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/availabilitySets/{}/vmSizes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineSizeListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod proximity_placement_groups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + proximity_placement_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + proximity_placement_group_name: proximity_placement_group_name.into(), + subscription_id: subscription_id.into(), + include_colocation_status: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + proximity_placement_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + proximity_placement_group_name: proximity_placement_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + proximity_placement_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + proximity_placement_group_name: proximity_placement_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + proximity_placement_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + proximity_placement_group_name: proximity_placement_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) proximity_placement_group_name: String, + pub(crate) subscription_id: String, + pub(crate) include_colocation_status: Option, + } + impl Builder { + pub fn include_colocation_status(mut self, include_colocation_status: impl Into) -> Self { + self.include_colocation_status = Some(include_colocation_status.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/proximityPlacementGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.proximity_placement_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(include_colocation_status) = &self.include_colocation_status { + url.query_pairs_mut() + .append_pair("includeColocationStatus", include_colocation_status); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProximityPlacementGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProximityPlacementGroup), + Created201(models::ProximityPlacementGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) proximity_placement_group_name: String, + pub(crate) parameters: models::ProximityPlacementGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/proximityPlacementGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.proximity_placement_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProximityPlacementGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProximityPlacementGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) proximity_placement_group_name: String, + pub(crate) parameters: models::ProximityPlacementGroupUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/proximityPlacementGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.proximity_placement_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProximityPlacementGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) proximity_placement_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/proximityPlacementGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.proximity_placement_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/proximityPlacementGroups", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProximityPlacementGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/proximityPlacementGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProximityPlacementGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod dedicated_host_groups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHostGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DedicatedHostGroup), + Created201(models::DedicatedHostGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) parameters: models::DedicatedHostGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHostGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHostGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) parameters: models::DedicatedHostGroupUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHostGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHostGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/hostGroups", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHostGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod dedicated_hosts { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + host_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + host_name: host_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + host_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + host_name: host_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + host_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + host_name: host_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + host_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + host_name: host_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_host_group( + &self, + resource_group_name: impl Into, + host_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_host_group::Builder { + list_by_host_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + host_group_name: host_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) host_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}/hosts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name, + &self.host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHost = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DedicatedHost), + Created201(models::DedicatedHost), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) host_name: String, + pub(crate) parameters: models::DedicatedHost, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}/hosts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name, + &self.host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHost = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHost = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) host_name: String, + pub(crate) parameters: models::DedicatedHostUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}/hosts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name, + &self.host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHost = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) host_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}/hosts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name, + &self.host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_host_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) host_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/hostGroups/{}/hosts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.host_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DedicatedHostListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod ssh_public_keys { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + ssh_public_key_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ssh_public_key_name: ssh_public_key_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + ssh_public_key_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ssh_public_key_name: ssh_public_key_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + ssh_public_key_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ssh_public_key_name: ssh_public_key_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + ssh_public_key_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ssh_public_key_name: ssh_public_key_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_key_pair( + &self, + resource_group_name: impl Into, + ssh_public_key_name: impl Into, + subscription_id: impl Into, + ) -> generate_key_pair::Builder { + generate_key_pair::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ssh_public_key_name: ssh_public_key_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/sshPublicKeys", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SshPublicKeysGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/sshPublicKeys", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SshPublicKeysGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ssh_public_key_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/sshPublicKeys/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ssh_public_key_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SshPublicKeyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::SshPublicKeyResource), + Created201(models::SshPublicKeyResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ssh_public_key_name: String, + pub(crate) parameters: models::SshPublicKeyResource, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/sshPublicKeys/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ssh_public_key_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SshPublicKeyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SshPublicKeyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ssh_public_key_name: String, + pub(crate) parameters: models::SshPublicKeyUpdateResource, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/sshPublicKeys/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ssh_public_key_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SshPublicKeyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ssh_public_key_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/sshPublicKeys/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ssh_public_key_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod generate_key_pair { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ssh_public_key_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/sshPublicKeys/{}/generateKeyPair", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ssh_public_key_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SshPublicKeyGenerateKeyPairResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_extension_images { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + location: impl Into, + publisher_name: impl Into, + type_: impl Into, + version: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + location: location.into(), + publisher_name: publisher_name.into(), + type_: type_.into(), + version: version.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_types( + &self, + location: impl Into, + publisher_name: impl Into, + subscription_id: impl Into, + ) -> list_types::Builder { + list_types::Builder { + client: self.0.clone(), + location: location.into(), + publisher_name: publisher_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_versions( + &self, + location: impl Into, + publisher_name: impl Into, + type_: impl Into, + subscription_id: impl Into, + ) -> list_versions::Builder { + list_versions::Builder { + client: self.0.clone(), + location: location.into(), + publisher_name: publisher_name.into(), + type_: type_.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + orderby: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) publisher_name: String, + pub(crate) type_: String, + pub(crate) version: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/publishers/{}/artifacttypes/vmextension/types/{}/versions/{}" , self . client . endpoint () , & self . subscription_id , & self . location , & self . publisher_name , & self . type_ , & self . version) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineExtensionImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_types { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) publisher_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/publishers/{}/artifacttypes/vmextension/types", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.publisher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_versions { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) publisher_name: String, + pub(crate) type_: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/publishers/{}/artifacttypes/vmextension/types/{}/versions" , self . client . endpoint () , & self . subscription_id , & self . location , & self . publisher_name , & self . type_) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_extensions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + vm_extension_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + vm_extension_name: vm_extension_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + vm_extension_name: impl Into, + extension_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + vm_extension_name: vm_extension_name.into(), + extension_parameters: extension_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + vm_extension_name: impl Into, + extension_parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + vm_extension_name: vm_extension_name.into(), + extension_parameters: extension_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + vm_extension_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + vm_extension_name: vm_extension_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) vm_extension_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name, + &self.vm_extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineExtension), + Created201(models::VirtualMachineExtension), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) vm_extension_name: String, + pub(crate) extension_parameters: models::VirtualMachineExtension, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name, + &self.vm_extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) vm_extension_name: String, + pub(crate) extension_parameters: models::VirtualMachineExtensionUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name, + &self.vm_extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) vm_extension_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name, + &self.vm_extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/extensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineExtensionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_images { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + location: impl Into, + publisher_name: impl Into, + offer: impl Into, + skus: impl Into, + version: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + location: location.into(), + publisher_name: publisher_name.into(), + offer: offer.into(), + skus: skus.into(), + version: version.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + location: impl Into, + publisher_name: impl Into, + offer: impl Into, + skus: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + publisher_name: publisher_name.into(), + offer: offer.into(), + skus: skus.into(), + subscription_id: subscription_id.into(), + expand: None, + top: None, + orderby: None, + } + } + pub fn list_offers( + &self, + location: impl Into, + publisher_name: impl Into, + subscription_id: impl Into, + ) -> list_offers::Builder { + list_offers::Builder { + client: self.0.clone(), + location: location.into(), + publisher_name: publisher_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_publishers(&self, location: impl Into, subscription_id: impl Into) -> list_publishers::Builder { + list_publishers::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_skus( + &self, + location: impl Into, + publisher_name: impl Into, + offer: impl Into, + subscription_id: impl Into, + ) -> list_skus::Builder { + list_skus::Builder { + client: self.0.clone(), + location: location.into(), + publisher_name: publisher_name.into(), + offer: offer.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) publisher_name: String, + pub(crate) offer: String, + pub(crate) skus: String, + pub(crate) version: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions/{}" , self . client . endpoint () , & self . subscription_id , & self . location , & self . publisher_name , & self . offer , & self . skus , & self . version) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) publisher_name: String, + pub(crate) offer: String, + pub(crate) skus: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + pub(crate) top: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions" , self . client . endpoint () , & self . subscription_id , & self . location , & self . publisher_name , & self . offer , & self . skus) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_offers { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) publisher_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.publisher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_publishers { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/publishers", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_skus { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) publisher_name: String, + pub(crate) offer: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.publisher_name, + &self.offer + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_images_edge_zone { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + location: impl Into, + edge_zone: impl Into, + publisher_name: impl Into, + offer: impl Into, + skus: impl Into, + version: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + location: location.into(), + edge_zone: edge_zone.into(), + publisher_name: publisher_name.into(), + offer: offer.into(), + skus: skus.into(), + version: version.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + location: impl Into, + edge_zone: impl Into, + publisher_name: impl Into, + offer: impl Into, + skus: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + edge_zone: edge_zone.into(), + publisher_name: publisher_name.into(), + offer: offer.into(), + skus: skus.into(), + subscription_id: subscription_id.into(), + expand: None, + top: None, + orderby: None, + } + } + pub fn list_offers( + &self, + location: impl Into, + edge_zone: impl Into, + publisher_name: impl Into, + subscription_id: impl Into, + ) -> list_offers::Builder { + list_offers::Builder { + client: self.0.clone(), + location: location.into(), + edge_zone: edge_zone.into(), + publisher_name: publisher_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_publishers( + &self, + location: impl Into, + edge_zone: impl Into, + subscription_id: impl Into, + ) -> list_publishers::Builder { + list_publishers::Builder { + client: self.0.clone(), + location: location.into(), + edge_zone: edge_zone.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_skus( + &self, + location: impl Into, + edge_zone: impl Into, + publisher_name: impl Into, + offer: impl Into, + subscription_id: impl Into, + ) -> list_skus::Builder { + list_skus::Builder { + client: self.0.clone(), + location: location.into(), + edge_zone: edge_zone.into(), + publisher_name: publisher_name.into(), + offer: offer.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) edge_zone: String, + pub(crate) publisher_name: String, + pub(crate) offer: String, + pub(crate) skus: String, + pub(crate) version: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/edgeZones/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions/{}" , self . client . endpoint () , & self . subscription_id , & self . location , & self . edge_zone , & self . publisher_name , & self . offer , & self . skus , & self . version) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) edge_zone: String, + pub(crate) publisher_name: String, + pub(crate) offer: String, + pub(crate) skus: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + pub(crate) top: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/edgeZones/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions" , self . client . endpoint () , & self . subscription_id , & self . location , & self . edge_zone , & self . publisher_name , & self . offer , & self . skus) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_offers { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) edge_zone: String, + pub(crate) publisher_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/edgeZones/{}/publishers/{}/artifacttypes/vmimage/offers" , self . client . endpoint () , & self . subscription_id , & self . location , & self . edge_zone , & self . publisher_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_publishers { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) edge_zone: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/edgeZones/{}/publishers", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.edge_zone + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_skus { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) edge_zone: String, + pub(crate) publisher_name: String, + pub(crate) offer: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/edgeZones/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus" , self . client . endpoint () , & self . subscription_id , & self . location , & self . edge_zone , & self . publisher_name , & self . offer) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod usage { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListUsagesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machines { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_location(&self, location: impl Into, subscription_id: impl Into) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn capture( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> capture::Builder { + capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + force_deletion: None, + } + } + pub fn instance_view( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> instance_view::Builder { + instance_view::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn convert_to_managed_disks( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> convert_to_managed_disks::Builder { + convert_to_managed_disks::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn deallocate( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> deallocate::Builder { + deallocate::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + hibernate: None, + } + } + pub fn generalize( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> generalize::Builder { + generalize::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + status_only: None, + } + } + pub fn list_available_sizes( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> list_available_sizes::Builder { + list_available_sizes::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn power_off( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> power_off::Builder { + power_off::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + skip_shutdown: None, + } + } + pub fn reapply( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> reapply::Builder { + reapply::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn restart( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn redeploy( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> redeploy::Builder { + redeploy::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reimage( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> reimage::Builder { + reimage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn retrieve_boot_diagnostics_data( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> retrieve_boot_diagnostics_data::Builder { + retrieve_boot_diagnostics_data::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + sas_uri_expiration_time_in_minutes: None, + } + } + pub fn perform_maintenance( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> perform_maintenance::Builder { + perform_maintenance::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn simulate_eviction( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> simulate_eviction::Builder { + simulate_eviction::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assess_patches( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> assess_patches::Builder { + assess_patches::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn install_patches( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + install_patches_input: impl Into, + subscription_id: impl Into, + ) -> install_patches::Builder { + install_patches::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + install_patches_input: install_patches_input.into(), + subscription_id: subscription_id.into(), + } + } + pub fn run_command( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_location { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/virtualMachines", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod capture { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineCaptureResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) parameters: models::VirtualMachineCaptureParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/capture", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineCaptureResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachine), + Created201(models::VirtualMachine), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) parameters: models::VirtualMachine, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) parameters: models::VirtualMachineUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + pub(crate) force_deletion: Option, + } + impl Builder { + pub fn force_deletion(mut self, force_deletion: bool) -> Self { + self.force_deletion = Some(force_deletion); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(force_deletion) = &self.force_deletion { + url.query_pairs_mut().append_pair("forceDeletion", &force_deletion.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod instance_view { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/instanceView", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineInstanceView = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod convert_to_managed_disks { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/convertToManagedDisks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod deallocate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + pub(crate) hibernate: Option, + } + impl Builder { + pub fn hibernate(mut self, hibernate: bool) -> Self { + self.hibernate = Some(hibernate); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/deallocate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(hibernate) = &self.hibernate { + url.query_pairs_mut().append_pair("hibernate", &hibernate.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod generalize { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/generalize", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) status_only: Option, + } + impl Builder { + pub fn status_only(mut self, status_only: impl Into) -> Self { + self.status_only = Some(status_only.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/virtualMachines", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(status_only) = &self.status_only { + url.query_pairs_mut().append_pair("statusOnly", status_only); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_available_sizes { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/vmSizes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineSizeListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod power_off { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + pub(crate) skip_shutdown: Option, + } + impl Builder { + pub fn skip_shutdown(mut self, skip_shutdown: bool) -> Self { + self.skip_shutdown = Some(skip_shutdown); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/powerOff", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(skip_shutdown) = &self.skip_shutdown { + url.query_pairs_mut().append_pair("skipShutdown", &skip_shutdown.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reapply { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/reapply", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod restart { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/restart", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod redeploy { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/redeploy", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reimage { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/reimage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod retrieve_boot_diagnostics_data { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + pub(crate) sas_uri_expiration_time_in_minutes: Option, + } + impl Builder { + pub fn sas_uri_expiration_time_in_minutes(mut self, sas_uri_expiration_time_in_minutes: i32) -> Self { + self.sas_uri_expiration_time_in_minutes = Some(sas_uri_expiration_time_in_minutes); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/retrieveBootDiagnosticsData", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(sas_uri_expiration_time_in_minutes) = &self.sas_uri_expiration_time_in_minutes { + url.query_pairs_mut() + .append_pair("sasUriExpirationTimeInMinutes", &sas_uri_expiration_time_in_minutes.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RetrieveBootDiagnosticsDataResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod perform_maintenance { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/performMaintenance", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod simulate_eviction { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/simulateEviction", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod assess_patches { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineAssessPatchesResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/assessPatches", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineAssessPatchesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod install_patches { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineInstallPatchesResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) install_patches_input: models::VirtualMachineInstallPatchesParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/installPatches", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.install_patches_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineInstallPatchesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RunCommandResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) parameters: models::RunCommandInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/runCommand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_scale_sets { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_location(&self, location: impl Into, subscription_id: impl Into) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + force_deletion: None, + } + } + pub fn deallocate( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> deallocate::Builder { + deallocate::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + vm_instance_i_ds: None, + } + } + pub fn delete_instances( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + vm_instance_i_ds: impl Into, + subscription_id: impl Into, + ) -> delete_instances::Builder { + delete_instances::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + vm_instance_i_ds: vm_instance_i_ds.into(), + subscription_id: subscription_id.into(), + force_deletion: None, + } + } + pub fn get_instance_view( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> get_instance_view::Builder { + get_instance_view::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_skus( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> list_skus::Builder { + list_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_os_upgrade_history( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> get_os_upgrade_history::Builder { + get_os_upgrade_history::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn power_off( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> power_off::Builder { + power_off::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + vm_instance_i_ds: None, + skip_shutdown: None, + } + } + pub fn restart( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + vm_instance_i_ds: None, + } + } + pub fn start( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + vm_instance_i_ds: None, + } + } + pub fn redeploy( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> redeploy::Builder { + redeploy::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + vm_instance_i_ds: None, + } + } + pub fn perform_maintenance( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> perform_maintenance::Builder { + perform_maintenance::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + vm_instance_i_ds: None, + } + } + pub fn update_instances( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + vm_instance_i_ds: impl Into, + subscription_id: impl Into, + ) -> update_instances::Builder { + update_instances::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + vm_instance_i_ds: vm_instance_i_ds.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reimage( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> reimage::Builder { + reimage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + vm_scale_set_reimage_input: None, + } + } + pub fn reimage_all( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> reimage_all::Builder { + reimage_all::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + vm_instance_i_ds: None, + } + } + pub fn force_recovery_service_fabric_platform_update_domain_walk( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + platform_update_domain: i64, + ) -> force_recovery_service_fabric_platform_update_domain_walk::Builder { + force_recovery_service_fabric_platform_update_domain_walk::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + platform_update_domain, + } + } + pub fn convert_to_single_placement_group( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> convert_to_single_placement_group::Builder { + convert_to_single_placement_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn set_orchestration_service_state( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> set_orchestration_service_state::Builder { + set_orchestration_service_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_location { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/virtualMachineScaleSets", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineScaleSet), + Created201(models::VirtualMachineScaleSet), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) parameters: models::VirtualMachineScaleSet, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) parameters: models::VirtualMachineScaleSetUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) force_deletion: Option, + } + impl Builder { + pub fn force_deletion(mut self, force_deletion: bool) -> Self { + self.force_deletion = Some(force_deletion); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(force_deletion) = &self.force_deletion { + url.query_pairs_mut().append_pair("forceDeletion", &force_deletion.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod deallocate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) vm_instance_i_ds: Option, + } + impl Builder { + pub fn vm_instance_i_ds(mut self, vm_instance_i_ds: impl Into) -> Self { + self.vm_instance_i_ds = Some(vm_instance_i_ds.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/deallocate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_instance_i_ds) = &self.vm_instance_i_ds { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_instance_i_ds).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_instances { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) vm_instance_i_ds: models::VirtualMachineScaleSetVmInstanceRequiredIDs, + pub(crate) subscription_id: String, + pub(crate) force_deletion: Option, + } + impl Builder { + pub fn force_deletion(mut self, force_deletion: bool) -> Self { + self.force_deletion = Some(force_deletion); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/delete", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vm_instance_i_ds).map_err(Error::Serialize)?; + if let Some(force_deletion) = &self.force_deletion { + url.query_pairs_mut().append_pair("forceDeletion", &force_deletion.to_string()); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_instance_view { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/instanceView", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetInstanceView = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/virtualMachineScaleSets", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetListWithLinkResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_skus { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/skus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetListSkusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_os_upgrade_history { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/osUpgradeHistory", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetListOsUpgradeHistory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod power_off { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) vm_instance_i_ds: Option, + pub(crate) skip_shutdown: Option, + } + impl Builder { + pub fn vm_instance_i_ds(mut self, vm_instance_i_ds: impl Into) -> Self { + self.vm_instance_i_ds = Some(vm_instance_i_ds.into()); + self + } + pub fn skip_shutdown(mut self, skip_shutdown: bool) -> Self { + self.skip_shutdown = Some(skip_shutdown); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/poweroff", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_instance_i_ds) = &self.vm_instance_i_ds { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_instance_i_ds).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + if let Some(skip_shutdown) = &self.skip_shutdown { + url.query_pairs_mut().append_pair("skipShutdown", &skip_shutdown.to_string()); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod restart { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) vm_instance_i_ds: Option, + } + impl Builder { + pub fn vm_instance_i_ds(mut self, vm_instance_i_ds: impl Into) -> Self { + self.vm_instance_i_ds = Some(vm_instance_i_ds.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/restart", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_instance_i_ds) = &self.vm_instance_i_ds { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_instance_i_ds).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) vm_instance_i_ds: Option, + } + impl Builder { + pub fn vm_instance_i_ds(mut self, vm_instance_i_ds: impl Into) -> Self { + self.vm_instance_i_ds = Some(vm_instance_i_ds.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_instance_i_ds) = &self.vm_instance_i_ds { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_instance_i_ds).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod redeploy { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) vm_instance_i_ds: Option, + } + impl Builder { + pub fn vm_instance_i_ds(mut self, vm_instance_i_ds: impl Into) -> Self { + self.vm_instance_i_ds = Some(vm_instance_i_ds.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/redeploy", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_instance_i_ds) = &self.vm_instance_i_ds { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_instance_i_ds).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod perform_maintenance { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) vm_instance_i_ds: Option, + } + impl Builder { + pub fn vm_instance_i_ds(mut self, vm_instance_i_ds: impl Into) -> Self { + self.vm_instance_i_ds = Some(vm_instance_i_ds.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/performMaintenance", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_instance_i_ds) = &self.vm_instance_i_ds { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_instance_i_ds).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_instances { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) vm_instance_i_ds: models::VirtualMachineScaleSetVmInstanceRequiredIDs, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/manualupgrade", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vm_instance_i_ds).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reimage { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) vm_scale_set_reimage_input: Option, + } + impl Builder { + pub fn vm_scale_set_reimage_input( + mut self, + vm_scale_set_reimage_input: impl Into, + ) -> Self { + self.vm_scale_set_reimage_input = Some(vm_scale_set_reimage_input.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/reimage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_scale_set_reimage_input) = &self.vm_scale_set_reimage_input { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_scale_set_reimage_input).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reimage_all { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) vm_instance_i_ds: Option, + } + impl Builder { + pub fn vm_instance_i_ds(mut self, vm_instance_i_ds: impl Into) -> Self { + self.vm_instance_i_ds = Some(vm_instance_i_ds.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/reimageall", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_instance_i_ds) = &self.vm_instance_i_ds { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_instance_i_ds).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod force_recovery_service_fabric_platform_update_domain_walk { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) platform_update_domain: i64, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/forceRecoveryServiceFabricPlatformUpdateDomainWalk" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let platform_update_domain = &self.platform_update_domain; + url.query_pairs_mut() + .append_pair("platformUpdateDomain", &platform_update_domain.to_string()); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryWalkResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod convert_to_single_placement_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) parameters: models::VmScaleSetConvertToSinglePlacementGroupInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/convertToSinglePlacementGroup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod set_orchestration_service_state { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) parameters: models::OrchestrationServiceStateInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/setOrchestrationServiceState" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_sizes { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/vmSizes", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineSizeListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod images { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + image_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + image_name: image_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + image_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + image_name: image_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + image_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + image_name: image_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + image_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + image_name: image_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) image_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Image = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Image), + Created201(models::Image), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) image_name: String, + pub(crate) parameters: models::Image, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Image = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Image = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Image), + Created201(models::Image), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) image_name: String, + pub(crate) parameters: models::ImageUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Image = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Image = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) image_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/images", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImageListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/images", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImageListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod restore_point_collections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into, resource_group_name: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.restore_point_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorePointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RestorePointCollection), + Created201(models::RestorePointCollection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) parameters: models::RestorePointCollection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.restore_point_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorePointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorePointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) parameters: models::RestorePointCollectionUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.restore_point_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorePointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.restore_point_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorePointCollectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/restorePointCollections", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorePointCollectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restore_points { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + restore_point_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + restore_point_name: restore_point_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + restore_point_name: impl Into, + parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + restore_point_name: restore_point_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + restore_point_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + restore_point_name: restore_point_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) restore_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}/restorePoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.restore_point_collection_name, + &self.restore_point_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorePoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) restore_point_name: String, + pub(crate) parameters: models::RestorePoint, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}/restorePoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.restore_point_collection_name, + &self.restore_point_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorePoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) restore_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}/restorePoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.restore_point_collection_name, + &self.restore_point_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod capacity_reservation_groups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + expand: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.capacity_reservation_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservationGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CapacityReservationGroup), + Created201(models::CapacityReservationGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) parameters: models::CapacityReservationGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.capacity_reservation_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservationGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservationGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) parameters: models::CapacityReservationGroupUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.capacity_reservation_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservationGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.capacity_reservation_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservationGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/capacityReservationGroups", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservationGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod capacity_reservations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + capacity_reservation_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + capacity_reservation_name: capacity_reservation_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + capacity_reservation_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + capacity_reservation_name: capacity_reservation_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + capacity_reservation_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + capacity_reservation_name: capacity_reservation_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + capacity_reservation_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + capacity_reservation_name: capacity_reservation_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_capacity_reservation_group( + &self, + resource_group_name: impl Into, + capacity_reservation_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_capacity_reservation_group::Builder { + list_by_capacity_reservation_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + capacity_reservation_group_name: capacity_reservation_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) capacity_reservation_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}/capacityReservations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . capacity_reservation_group_name , & self . capacity_reservation_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CapacityReservation), + Created201(models::CapacityReservation), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) capacity_reservation_name: String, + pub(crate) parameters: models::CapacityReservation, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}/capacityReservations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . capacity_reservation_group_name , & self . capacity_reservation_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::CapacityReservation), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) capacity_reservation_name: String, + pub(crate) parameters: models::CapacityReservationUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}/capacityReservations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . capacity_reservation_group_name , & self . capacity_reservation_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) capacity_reservation_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}/capacityReservations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . capacity_reservation_group_name , & self . capacity_reservation_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_capacity_reservation_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) capacity_reservation_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/capacityReservationGroups/{}/capacityReservations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . capacity_reservation_group_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityReservationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_scale_set_extensions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + vmss_extension_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + vmss_extension_name: vmss_extension_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + vmss_extension_name: impl Into, + extension_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + vmss_extension_name: vmss_extension_name.into(), + extension_parameters: extension_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + vmss_extension_name: impl Into, + extension_parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + vmss_extension_name: vmss_extension_name.into(), + extension_parameters: extension_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + vmss_extension_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + vmss_extension_name: vmss_extension_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) vmss_extension_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name, + &self.vmss_extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineScaleSetExtension), + Created201(models::VirtualMachineScaleSetExtension), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) vmss_extension_name: String, + pub(crate) extension_parameters: models::VirtualMachineScaleSetExtension, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name, + &self.vmss_extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineScaleSetExtension), + Created201(models::VirtualMachineScaleSetExtension), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) vmss_extension_name: String, + pub(crate) extension_parameters: models::VirtualMachineScaleSetExtensionUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name, + &self.vmss_extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) vmss_extension_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name, + &self.vmss_extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/extensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetExtensionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_scale_set_rolling_upgrades { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn cancel( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> cancel::Builder { + cancel::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start_os_upgrade( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> start_os_upgrade::Builder { + start_os_upgrade::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start_extension_upgrade( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> start_extension_upgrade::Builder { + start_extension_upgrade::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_latest( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> get_latest::Builder { + get_latest::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod cancel { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/rollingUpgrades/cancel" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod start_os_upgrade { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/osRollingUpgrade", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod start_extension_upgrade { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/extensionRollingUpgrade" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_latest { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/rollingUpgrades/latest" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RollingUpgradeStatusInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_scale_set_vm_extensions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + vm_extension_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + vm_extension_name: vm_extension_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + vm_extension_name: impl Into, + extension_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + vm_extension_name: vm_extension_name.into(), + extension_parameters: extension_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + vm_extension_name: impl Into, + extension_parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + vm_extension_name: vm_extension_name.into(), + extension_parameters: extension_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + vm_extension_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + vm_extension_name: vm_extension_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) vm_extension_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id , & self . vm_extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVmExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineScaleSetVmExtension), + Created201(models::VirtualMachineScaleSetVmExtension), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) vm_extension_name: String, + pub(crate) extension_parameters: models::VirtualMachineScaleSetVmExtension, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id , & self . vm_extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVmExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVmExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) vm_extension_name: String, + pub(crate) extension_parameters: models::VirtualMachineScaleSetVmExtensionUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id , & self . vm_extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVmExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) vm_extension_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id , & self . vm_extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/extensions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVmExtensionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_scale_set_v_ms { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn reimage( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> reimage::Builder { + reimage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + vm_scale_set_vm_reimage_input: None, + } + } + pub fn reimage_all( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> reimage_all::Builder { + reimage_all::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn deallocate( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> deallocate::Builder { + deallocate::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + force_deletion: None, + } + } + pub fn get_instance_view( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> get_instance_view::Builder { + get_instance_view::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + subscription_id: subscription_id.into(), + filter: None, + select: None, + expand: None, + } + } + pub fn power_off( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> power_off::Builder { + power_off::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + skip_shutdown: None, + } + } + pub fn restart( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn redeploy( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> redeploy::Builder { + redeploy::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn retrieve_boot_diagnostics_data( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> retrieve_boot_diagnostics_data::Builder { + retrieve_boot_diagnostics_data::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + sas_uri_expiration_time_in_minutes: None, + } + } + pub fn perform_maintenance( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> perform_maintenance::Builder { + perform_maintenance::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn simulate_eviction( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> simulate_eviction::Builder { + simulate_eviction::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn run_command( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod reimage { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + pub(crate) vm_scale_set_vm_reimage_input: Option, + } + impl Builder { + pub fn vm_scale_set_vm_reimage_input( + mut self, + vm_scale_set_vm_reimage_input: impl Into, + ) -> Self { + self.vm_scale_set_vm_reimage_input = Some(vm_scale_set_vm_reimage_input.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/reimage" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(vm_scale_set_vm_reimage_input) = &self.vm_scale_set_vm_reimage_input { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(vm_scale_set_vm_reimage_input).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reimage_all { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/reimageall" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod deallocate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/deallocate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name, + &self.instance_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineScaleSetVm), + Accepted202(models::VirtualMachineScaleSetVm), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) parameters: models::VirtualMachineScaleSetVm, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name, + &self.instance_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + pub(crate) force_deletion: Option, + } + impl Builder { + pub fn force_deletion(mut self, force_deletion: bool) -> Self { + self.force_deletion = Some(force_deletion); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_scale_set_name, + &self.instance_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(force_deletion) = &self.force_deletion { + url.query_pairs_mut().append_pair("forceDeletion", &force_deletion.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_instance_view { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/instanceView" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVmInstanceView = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) select: Option, + pub(crate) expand: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineScaleSetVmListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod power_off { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + pub(crate) skip_shutdown: Option, + } + impl Builder { + pub fn skip_shutdown(mut self, skip_shutdown: bool) -> Self { + self.skip_shutdown = Some(skip_shutdown); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/poweroff" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(skip_shutdown) = &self.skip_shutdown { + url.query_pairs_mut().append_pair("skipShutdown", &skip_shutdown.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod restart { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/restart" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/start" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod redeploy { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/redeploy" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod retrieve_boot_diagnostics_data { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + pub(crate) sas_uri_expiration_time_in_minutes: Option, + } + impl Builder { + pub fn sas_uri_expiration_time_in_minutes(mut self, sas_uri_expiration_time_in_minutes: i32) -> Self { + self.sas_uri_expiration_time_in_minutes = Some(sas_uri_expiration_time_in_minutes); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/retrieveBootDiagnosticsData" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(sas_uri_expiration_time_in_minutes) = &self.sas_uri_expiration_time_in_minutes { + url.query_pairs_mut() + .append_pair("sasUriExpirationTimeInMinutes", &sas_uri_expiration_time_in_minutes.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RetrieveBootDiagnosticsDataResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod perform_maintenance { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/performMaintenance" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod simulate_eviction { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/simulateEviction" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RunCommandResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) parameters: models::RunCommandInput, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualmachines/{}/runCommand" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod log_analytics { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn export_request_rate_by_interval( + &self, + parameters: impl Into, + location: impl Into, + subscription_id: impl Into, + ) -> export_request_rate_by_interval::Builder { + export_request_rate_by_interval::Builder { + client: self.0.clone(), + parameters: parameters.into(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn export_throttled_requests( + &self, + parameters: impl Into, + location: impl Into, + subscription_id: impl Into, + ) -> export_throttled_requests::Builder { + export_throttled_requests::Builder { + client: self.0.clone(), + parameters: parameters.into(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod export_request_rate_by_interval { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::LogAnalyticsOperationResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::RequestRateByIntervalInput, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/logAnalytics/apiAccess/getRequestRateByInterval", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogAnalyticsOperationResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod export_throttled_requests { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::LogAnalyticsOperationResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::ThrottledRequestsInput, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/logAnalytics/apiAccess/getThrottledRequests", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogAnalyticsOperationResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_run_commands { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get(&self, location: impl Into, command_id: impl Into, subscription_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + location: location.into(), + command_id: command_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_by_virtual_machine( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + run_command_name: impl Into, + subscription_id: impl Into, + ) -> get_by_virtual_machine::Builder { + get_by_virtual_machine::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + run_command_name: run_command_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + run_command_name: impl Into, + run_command: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + run_command_name: run_command_name.into(), + run_command: run_command.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + run_command_name: impl Into, + run_command: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + run_command_name: run_command_name.into(), + run_command: run_command.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + run_command_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + run_command_name: run_command_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_virtual_machine( + &self, + resource_group_name: impl Into, + vm_name: impl Into, + subscription_id: impl Into, + ) -> list_by_virtual_machine::Builder { + list_by_virtual_machine::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_name: vm_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/runCommands", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) command_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/runCommands/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.command_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandDocument = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_by_virtual_machine { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) run_command_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/runCommands/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name, + &self.run_command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineRunCommand), + Created201(models::VirtualMachineRunCommand), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) run_command_name: String, + pub(crate) run_command: models::VirtualMachineRunCommand, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/runCommands/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name, + &self.run_command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.run_command).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) run_command_name: String, + pub(crate) run_command: models::VirtualMachineRunCommandUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/runCommands/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name, + &self.run_command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.run_command).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) run_command_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/runCommands/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name, + &self.run_command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_virtual_machine { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/runCommands", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommandsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_scale_set_vm_run_commands { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + run_command_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + run_command_name: run_command_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + run_command_name: impl Into, + run_command: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + run_command_name: run_command_name.into(), + run_command: run_command.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + run_command_name: impl Into, + run_command: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + run_command_name: run_command_name.into(), + run_command: run_command.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + run_command_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + run_command_name: run_command_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + vm_scale_set_name: impl Into, + instance_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + vm_scale_set_name: vm_scale_set_name.into(), + instance_id: instance_id.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) run_command_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/runCommands/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id , & self . run_command_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineRunCommand), + Created201(models::VirtualMachineRunCommand), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) run_command_name: String, + pub(crate) run_command: models::VirtualMachineRunCommand, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/runCommands/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id , & self . run_command_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.run_command).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) run_command_name: String, + pub(crate) run_command: models::VirtualMachineRunCommandUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/runCommands/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id , & self . run_command_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.run_command).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) run_command_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/runCommands/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id , & self . run_command_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) vm_scale_set_name: String, + pub(crate) instance_id: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/runCommands" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vm_scale_set_name , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineRunCommandsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_skus { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + filter: None, + include_extended_locations: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) include_extended_locations: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn include_extended_locations(mut self, include_extended_locations: impl Into) -> Self { + self.include_extended_locations = Some(include_extended_locations.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/skus", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(include_extended_locations) = &self.include_extended_locations { + url.query_pairs_mut() + .append_pair("includeExtendedLocations", include_extended_locations); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceSkusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod disks { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_name: disk_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_name: impl Into, + disk: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_name: disk_name.into(), + disk: disk.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_name: impl Into, + disk: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_name: disk_name.into(), + disk: disk.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_name: disk_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn grant_access( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_name: impl Into, + grant_access_data: impl Into, + ) -> grant_access::Builder { + grant_access::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_name: disk_name.into(), + grant_access_data: grant_access_data.into(), + } + } + pub fn revoke_access( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_name: impl Into, + ) -> revoke_access::Builder { + revoke_access::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_name: disk_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/disks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Disk = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Disk), + Accepted202(models::Disk), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_name: String, + pub(crate) disk: models::Disk, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/disks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.disk).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Disk = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Disk = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Disk), + Accepted202(models::Disk), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_name: String, + pub(crate) disk: models::DiskUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/disks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.disk).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Disk = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Disk = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/disks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/disks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/disks", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod grant_access { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AccessUri), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_name: String, + pub(crate) grant_access_data: models::GrantAccessData, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/disks/{}/beginGetAccess", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.grant_access_data).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessUri = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod revoke_access { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/disks/{}/endGetAccess", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod snapshots { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + snapshot_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + snapshot_name: snapshot_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + snapshot_name: impl Into, + snapshot: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + snapshot_name: snapshot_name.into(), + snapshot: snapshot.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + snapshot_name: impl Into, + snapshot: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + snapshot_name: snapshot_name.into(), + snapshot: snapshot.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + snapshot_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + snapshot_name: snapshot_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn grant_access( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + snapshot_name: impl Into, + grant_access_data: impl Into, + ) -> grant_access::Builder { + grant_access::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + snapshot_name: snapshot_name.into(), + grant_access_data: grant_access_data.into(), + } + } + pub fn revoke_access( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + snapshot_name: impl Into, + ) -> revoke_access::Builder { + revoke_access::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + snapshot_name: snapshot_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) snapshot_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.snapshot_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Accepted202(models::Snapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) snapshot_name: String, + pub(crate) snapshot: models::Snapshot, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.snapshot_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.snapshot).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Accepted202(models::Snapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) snapshot_name: String, + pub(crate) snapshot: models::SnapshotUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.snapshot_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.snapshot).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) snapshot_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.snapshot_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/snapshots", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/snapshots", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod grant_access { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AccessUri), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) snapshot_name: String, + pub(crate) grant_access_data: models::GrantAccessData, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/snapshots/{}/beginGetAccess", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.snapshot_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.grant_access_data).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessUri = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod revoke_access { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) snapshot_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/snapshots/{}/endGetAccess", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.snapshot_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod disk_encryption_sets { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_encryption_set_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_encryption_set_name: disk_encryption_set_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_encryption_set_name: impl Into, + disk_encryption_set: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_encryption_set_name: disk_encryption_set_name.into(), + disk_encryption_set: disk_encryption_set.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_encryption_set_name: impl Into, + disk_encryption_set: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_encryption_set_name: disk_encryption_set_name.into(), + disk_encryption_set: disk_encryption_set.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_encryption_set_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_encryption_set_name: disk_encryption_set_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_associated_resources( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_encryption_set_name: impl Into, + ) -> list_associated_resources::Builder { + list_associated_resources::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_encryption_set_name: disk_encryption_set_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_encryption_set_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskEncryptionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_encryption_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskEncryptionSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DiskEncryptionSet), + Accepted202(models::DiskEncryptionSet), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_encryption_set_name: String, + pub(crate) disk_encryption_set: models::DiskEncryptionSet, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskEncryptionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_encryption_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.disk_encryption_set).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskEncryptionSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskEncryptionSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DiskEncryptionSet), + Accepted202(models::DiskEncryptionSet), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_encryption_set_name: String, + pub(crate) disk_encryption_set: models::DiskEncryptionSetUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskEncryptionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_encryption_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.disk_encryption_set).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskEncryptionSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskEncryptionSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_encryption_set_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskEncryptionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_encryption_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskEncryptionSets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskEncryptionSetList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/diskEncryptionSets", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskEncryptionSetList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_associated_resources { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_encryption_set_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskEncryptionSets/{}/associatedResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_encryption_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceUriList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod disk_accesses { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + disk_access: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + disk_access: disk_access.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + disk_access: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + disk_access: disk_access.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_private_link_resources( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + ) -> get_private_link_resources::Builder { + get_private_link_resources::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + } + } + pub fn get_a_private_endpoint_connection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get_a_private_endpoint_connection::Builder { + get_a_private_endpoint_connection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn update_a_private_endpoint_connection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + private_endpoint_connection_name: impl Into, + private_endpoint_connection: impl Into, + ) -> update_a_private_endpoint_connection::Builder { + update_a_private_endpoint_connection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + private_endpoint_connection: private_endpoint_connection.into(), + } + } + pub fn delete_a_private_endpoint_connection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete_a_private_endpoint_connection::Builder { + delete_a_private_endpoint_connection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn list_private_endpoint_connections( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + disk_access_name: impl Into, + ) -> list_private_endpoint_connections::Builder { + list_private_endpoint_connections::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + disk_access_name: disk_access_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskAccess = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DiskAccess), + Accepted202(models::DiskAccess), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + pub(crate) disk_access: models::DiskAccess, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.disk_access).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskAccess = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskAccess = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::DiskAccess), + Accepted202(models::DiskAccess), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + pub(crate) disk_access: models::DiskAccessUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.disk_access).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskAccess = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskAccess = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskAccessList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/diskAccesses", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskAccessList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_private_link_resources { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_a_private_endpoint_connection { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_a_private_endpoint_connection { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnection), + Accepted202(models::PrivateEndpointConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) private_endpoint_connection: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.private_endpoint_connection).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_a_private_endpoint_connection { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_private_endpoint_connections { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) disk_access_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/diskAccesses/{}/privateEndpointConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.disk_access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod disk_restore_point { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + vm_restore_point_name: impl Into, + disk_restore_point_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + vm_restore_point_name: vm_restore_point_name.into(), + disk_restore_point_name: disk_restore_point_name.into(), + } + } + pub fn list_by_restore_point( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + vm_restore_point_name: impl Into, + ) -> list_by_restore_point::Builder { + list_by_restore_point::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + vm_restore_point_name: vm_restore_point_name.into(), + } + } + pub fn grant_access( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + vm_restore_point_name: impl Into, + disk_restore_point_name: impl Into, + grant_access_data: impl Into, + ) -> grant_access::Builder { + grant_access::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + vm_restore_point_name: vm_restore_point_name.into(), + disk_restore_point_name: disk_restore_point_name.into(), + grant_access_data: grant_access_data.into(), + } + } + pub fn revoke_access( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + restore_point_collection_name: impl Into, + vm_restore_point_name: impl Into, + disk_restore_point_name: impl Into, + ) -> revoke_access::Builder { + revoke_access::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + restore_point_collection_name: restore_point_collection_name.into(), + vm_restore_point_name: vm_restore_point_name.into(), + disk_restore_point_name: disk_restore_point_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) vm_restore_point_name: String, + pub(crate) disk_restore_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}/restorePoints/{}/diskRestorePoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . restore_point_collection_name , & self . vm_restore_point_name , & self . disk_restore_point_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskRestorePoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_restore_point { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) vm_restore_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}/restorePoints/{}/diskRestorePoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . restore_point_collection_name , & self . vm_restore_point_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiskRestorePointList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod grant_access { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AccessUri), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) vm_restore_point_name: String, + pub(crate) disk_restore_point_name: String, + pub(crate) grant_access_data: models::GrantAccessData, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}/restorePoints/{}/diskRestorePoints/{}/beginGetAccess" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . restore_point_collection_name , & self . vm_restore_point_name , & self . disk_restore_point_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.grant_access_data).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessUri = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod revoke_access { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) restore_point_collection_name: String, + pub(crate) vm_restore_point_name: String, + pub(crate) disk_restore_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/restorePointCollections/{}/restorePoints/{}/diskRestorePoints/{}/endGetAccess" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . restore_point_collection_name , & self . vm_restore_point_name , & self . disk_restore_point_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod galleries { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + select: None, + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery: gallery.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery: gallery.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) select: Option, + } + impl Builder { + pub fn select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Gallery = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Gallery), + Created201(models::Gallery), + Accepted202(models::Gallery), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery: models::Gallery, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Gallery = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Gallery = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Gallery = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery: models::GalleryUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Gallery = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/galleries", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gallery_images { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + gallery_image: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + gallery_image: gallery_image.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + gallery_image: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + gallery_image: gallery_image.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + } + } + pub fn list_by_gallery( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + ) -> list_by_gallery::Builder { + list_by_gallery::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::GalleryImage), + Created201(models::GalleryImage), + Accepted202(models::GalleryImage), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + pub(crate) gallery_image: models::GalleryImage, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery_image).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + pub(crate) gallery_image: models::GalleryImageUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery_image).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_gallery { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gallery_image_versions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + gallery_image_version_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + gallery_image_version_name: gallery_image_version_name.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + gallery_image_version_name: impl Into, + gallery_image_version: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + gallery_image_version_name: gallery_image_version_name.into(), + gallery_image_version: gallery_image_version.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + gallery_image_version_name: impl Into, + gallery_image_version: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + gallery_image_version_name: gallery_image_version_name.into(), + gallery_image_version: gallery_image_version.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + gallery_image_version_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + gallery_image_version_name: gallery_image_version_name.into(), + } + } + pub fn list_by_gallery_image( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_image_name: impl Into, + ) -> list_by_gallery_image::Builder { + list_by_gallery_image::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + pub(crate) gallery_image_version_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name, + &self.gallery_image_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImageVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::GalleryImageVersion), + Created201(models::GalleryImageVersion), + Accepted202(models::GalleryImageVersion), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + pub(crate) gallery_image_version_name: String, + pub(crate) gallery_image_version: models::GalleryImageVersion, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name, + &self.gallery_image_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery_image_version).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImageVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImageVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImageVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + pub(crate) gallery_image_version_name: String, + pub(crate) gallery_image_version: models::GalleryImageVersionUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name, + &self.gallery_image_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery_image_version).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImageVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + pub(crate) gallery_image_version_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name, + &self.gallery_image_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_gallery_image { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_image_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/images/{}/versions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryImageVersionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gallery_applications { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + gallery_application: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + gallery_application: gallery_application.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + gallery_application: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + gallery_application: gallery_application.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + } + } + pub fn list_by_gallery( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + ) -> list_by_gallery::Builder { + list_by_gallery::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::GalleryApplication), + Created201(models::GalleryApplication), + Accepted202(models::GalleryApplication), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + pub(crate) gallery_application: models::GalleryApplication, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery_application).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + pub(crate) gallery_application: models::GalleryApplicationUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery_application).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_gallery { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplicationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gallery_application_versions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + gallery_application_version_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + gallery_application_version_name: gallery_application_version_name.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + gallery_application_version_name: impl Into, + gallery_application_version: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + gallery_application_version_name: gallery_application_version_name.into(), + gallery_application_version: gallery_application_version.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + gallery_application_version_name: impl Into, + gallery_application_version: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + gallery_application_version_name: gallery_application_version_name.into(), + gallery_application_version: gallery_application_version.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + gallery_application_version_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + gallery_application_version_name: gallery_application_version_name.into(), + } + } + pub fn list_by_gallery_application( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + gallery_application_name: impl Into, + ) -> list_by_gallery_application::Builder { + list_by_gallery_application::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + gallery_application_name: gallery_application_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + pub(crate) gallery_application_version_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name, + &self.gallery_application_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplicationVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::GalleryApplicationVersion), + Created201(models::GalleryApplicationVersion), + Accepted202(models::GalleryApplicationVersion), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + pub(crate) gallery_application_version_name: String, + pub(crate) gallery_application_version: models::GalleryApplicationVersion, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name, + &self.gallery_application_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery_application_version).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplicationVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplicationVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplicationVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + pub(crate) gallery_application_version_name: String, + pub(crate) gallery_application_version: models::GalleryApplicationVersionUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name, + &self.gallery_application_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.gallery_application_version).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplicationVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + pub(crate) gallery_application_version_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name, + &self.gallery_application_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_gallery_application { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) gallery_application_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/applications/{}/versions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name, + &self.gallery_application_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GalleryApplicationVersionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gallery_sharing_profile { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gallery_name: impl Into, + sharing_update: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gallery_name: gallery_name.into(), + sharing_update: sharing_update.into(), + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::SharingUpdate), + Accepted202(models::SharingUpdate), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gallery_name: String, + pub(crate) sharing_update: models::SharingUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/galleries/{}/share", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gallery_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.sharing_update).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SharingUpdate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SharingUpdate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod shared_galleries { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into, location: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + shared_to: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + gallery_unique_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + gallery_unique_name: gallery_unique_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) shared_to: Option, + } + impl Builder { + pub fn shared_to(mut self, shared_to: impl Into) -> Self { + self.shared_to = Some(shared_to.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/sharedGalleries", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(shared_to) = &self.shared_to { + url.query_pairs_mut().append_pair("sharedTo", shared_to); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SharedGalleryList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) gallery_unique_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/sharedGalleries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.gallery_unique_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SharedGallery = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod shared_gallery_images { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + gallery_unique_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + gallery_unique_name: gallery_unique_name.into(), + shared_to: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + gallery_unique_name: impl Into, + gallery_image_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + gallery_unique_name: gallery_unique_name.into(), + gallery_image_name: gallery_image_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) gallery_unique_name: String, + pub(crate) shared_to: Option, + } + impl Builder { + pub fn shared_to(mut self, shared_to: impl Into) -> Self { + self.shared_to = Some(shared_to.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/sharedGalleries/{}/images", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.gallery_unique_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(shared_to) = &self.shared_to { + url.query_pairs_mut().append_pair("sharedTo", shared_to); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SharedGalleryImageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) gallery_unique_name: String, + pub(crate) gallery_image_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/sharedGalleries/{}/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.gallery_unique_name, + &self.gallery_image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SharedGalleryImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod shared_gallery_image_versions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + gallery_unique_name: impl Into, + gallery_image_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + gallery_unique_name: gallery_unique_name.into(), + gallery_image_name: gallery_image_name.into(), + shared_to: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + gallery_unique_name: impl Into, + gallery_image_name: impl Into, + gallery_image_version_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + gallery_unique_name: gallery_unique_name.into(), + gallery_image_name: gallery_image_name.into(), + gallery_image_version_name: gallery_image_version_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) gallery_unique_name: String, + pub(crate) gallery_image_name: String, + pub(crate) shared_to: Option, + } + impl Builder { + pub fn shared_to(mut self, shared_to: impl Into) -> Self { + self.shared_to = Some(shared_to.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/sharedGalleries/{}/images/{}/versions", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.gallery_unique_name, + &self.gallery_image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(shared_to) = &self.shared_to { + url.query_pairs_mut().append_pair("sharedTo", shared_to); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SharedGalleryImageVersionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) gallery_unique_name: String, + pub(crate) gallery_image_name: String, + pub(crate) gallery_image_version_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/sharedGalleries/{}/images/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.gallery_unique_name, + &self.gallery_image_name, + &self.gallery_image_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SharedGalleryImageVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod community_galleries { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + public_gallery_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + public_gallery_name: public_gallery_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) public_gallery_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/communityGalleries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.public_gallery_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CommunityGallery = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod community_gallery_images { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + public_gallery_name: impl Into, + gallery_image_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + public_gallery_name: public_gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) public_gallery_name: String, + pub(crate) gallery_image_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/communityGalleries/{}/images/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.public_gallery_name, + &self.gallery_image_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CommunityGalleryImage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod community_gallery_image_versions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + public_gallery_name: impl Into, + gallery_image_name: impl Into, + gallery_image_version_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + public_gallery_name: public_gallery_name.into(), + gallery_image_name: gallery_image_name.into(), + gallery_image_version_name: gallery_image_version_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) public_gallery_name: String, + pub(crate) gallery_image_name: String, + pub(crate) gallery_image_version_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/communityGalleries/{}/images/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.public_gallery_name, + &self.gallery_image_name, + &self.gallery_image_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CommunityGalleryImageVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cloud_service_role_instances { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + role_instance_name: impl Into, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + role_instance_name: role_instance_name.into(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn delete( + &self, + role_instance_name: impl Into, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + role_instance_name: role_instance_name.into(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_instance_view( + &self, + role_instance_name: impl Into, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> get_instance_view::Builder { + get_instance_view::Builder { + client: self.0.clone(), + role_instance_name: role_instance_name.into(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn restart( + &self, + role_instance_name: impl Into, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + role_instance_name: role_instance_name.into(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reimage( + &self, + role_instance_name: impl Into, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> reimage::Builder { + reimage::Builder { + client: self.0.clone(), + role_instance_name: role_instance_name.into(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn rebuild( + &self, + role_instance_name: impl Into, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> rebuild::Builder { + rebuild::Builder { + client: self.0.clone(), + role_instance_name: role_instance_name.into(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_remote_desktop_file( + &self, + role_instance_name: impl Into, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> get_remote_desktop_file::Builder { + get_remote_desktop_file::Builder { + client: self.0.clone(), + role_instance_name: role_instance_name.into(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_instance_name: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.role_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleInstance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_instance_name: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.role_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_instance_view { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_instance_name: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/instanceView", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.role_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleInstanceInstanceView = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleInstanceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod restart { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_instance_name: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/restart", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.role_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reimage { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_instance_name: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/reimage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.role_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rebuild { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_instance_name: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/rebuild", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.role_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_remote_desktop_file { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_instance_name: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/remoteDesktopFile" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cloud_service_name , & self . role_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value = rsp_body; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cloud_service_roles { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + role_name: impl Into, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + role_name: role_name.into(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_name: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.role_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudServiceRole = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roles", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudServiceRoleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cloud_services { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_instance_view( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> get_instance_view::Builder { + get_instance_view::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn power_off( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> power_off::Builder { + power_off::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn restart( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn reimage( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> reimage::Builder { + reimage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn rebuild( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> rebuild::Builder { + rebuild::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn delete_instances( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> delete_instances::Builder { + delete_instances::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CloudService), + Created201(models::CloudService), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_instance_view { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/instanceView", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudServiceInstanceView = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/cloudServices", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod power_off { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/poweroff", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod restart { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/restart", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reimage { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/reimage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rebuild { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/rebuild", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_instances { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/delete", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cloud_services_update_domain { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_update_domain( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + update_domain: i32, + subscription_id: impl Into, + ) -> get_update_domain::Builder { + get_update_domain::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + update_domain, + subscription_id: subscription_id.into(), + } + } + pub fn walk_update_domain( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + update_domain: i32, + subscription_id: impl Into, + ) -> walk_update_domain::Builder { + walk_update_domain::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + update_domain, + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn list_update_domains( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> list_update_domains::Builder { + list_update_domains::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get_update_domain { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) update_domain: i32, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/updateDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.update_domain + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateDomain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod walk_update_domain { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) update_domain: i32, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/updateDomains/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name, + &self.update_domain + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_update_domains { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/updateDomains", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateDomainListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cloud_service_operating_systems { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_os_version( + &self, + location: impl Into, + os_version_name: impl Into, + subscription_id: impl Into, + ) -> get_os_version::Builder { + get_os_version::Builder { + client: self.0.clone(), + location: location.into(), + os_version_name: os_version_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_os_versions(&self, location: impl Into, subscription_id: impl Into) -> list_os_versions::Builder { + list_os_versions::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_os_family( + &self, + location: impl Into, + os_family_name: impl Into, + subscription_id: impl Into, + ) -> get_os_family::Builder { + get_os_family::Builder { + client: self.0.clone(), + location: location.into(), + os_family_name: os_family_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_os_families(&self, location: impl Into, subscription_id: impl Into) -> list_os_families::Builder { + list_os_families::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get_os_version { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) os_version_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/cloudServiceOsVersions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.os_version_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_os_versions { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/cloudServiceOsVersions", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsVersionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_os_family { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) os_family_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/cloudServiceOsFamilies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.os_family_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsFamily = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_os_families { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Compute/locations/{}/cloudServiceOsFamilies", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsFamilyListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/connectedvmware/src/package_2020_10_01_preview/operations.rs b/services/mgmt/connectedvmware/src/package_2020_10_01_preview/operations.rs index cc43d561f3..2adc792151 100644 --- a/services/mgmt/connectedvmware/src/package_2020_10_01_preview/operations.rs +++ b/services/mgmt/connectedvmware/src/package_2020_10_01_preview/operations.rs @@ -3551,6 +3551,7 @@ pub mod virtual_machines { pub enum Response { Ok200(models::VirtualMachine), Created201(models::VirtualMachine), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3629,6 +3630,7 @@ pub mod virtual_machines { serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Created201(rsp_value)) } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = diff --git a/services/mgmt/consumption/src/package_2021_10/models.rs b/services/mgmt/consumption/src/package_2021_10/models.rs index ee1b9cca66..9520929425 100644 --- a/services/mgmt/consumption/src/package_2021_10/models.rs +++ b/services/mgmt/consumption/src/package_2021_10/models.rs @@ -379,8 +379,7 @@ pub struct LegacyReservationRecommendationProperties { pub net_savings: Option, #[serde(rename = "firstUsageDate", default, skip_serializing_if = "Option::is_none")] pub first_usage_date: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub scope: Option, + pub scope: String, #[serde(rename = "skuProperties", default, skip_serializing_if = "Vec::is_empty")] pub sku_properties: Vec, } @@ -440,6 +439,18 @@ pub struct LegacyReservationTransactionProperties { pub overage: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LegacySharedScopeReservationRecommendationProperties { + #[serde(flatten)] + pub legacy_reservation_recommendation_properties: LegacyReservationRecommendationProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LegacySingleScopeReservationRecommendationProperties { + #[serde(flatten)] + pub legacy_reservation_recommendation_properties: LegacyReservationRecommendationProperties, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct LegacyUsageDetail { #[serde(flatten)] pub usage_detail: UsageDetail, diff --git a/services/mgmt/consumption/src/package_2021_10/operations.rs b/services/mgmt/consumption/src/package_2021_10/operations.rs index d1ccc07b7a..dbb9159d1b 100644 --- a/services/mgmt/consumption/src/package_2021_10/operations.rs +++ b/services/mgmt/consumption/src/package_2021_10/operations.rs @@ -1110,7 +1110,12 @@ pub mod balances { impl Builder { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/providers/Microsoft.Billing/billingPeriods/{}/providers/Microsoft.Consumption/balances" , self . client . endpoint () , & self . billing_account_id , & self . billing_period_name) ; + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingPeriods/{}/providers/Microsoft.Consumption/balances", + self.client.endpoint(), + &self.billing_account_id, + &self.billing_period_name + ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); diff --git a/services/mgmt/containerregistry/Cargo.toml b/services/mgmt/containerregistry/Cargo.toml index 49c9a29d1d..61ebb89fc6 100644 --- a/services/mgmt/containerregistry/Cargo.toml +++ b/services/mgmt/containerregistry/Cargo.toml @@ -19,10 +19,12 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2019-05-only", "enable_reqwest"] +default = ["package-2021-09-only", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-09-only" = [] +"package-2021-09" = [] "package-2021-08-preview-only" = [] "package-2021-08-preview" = [] "package-2021-06-preview-only" = [] diff --git a/services/mgmt/containerregistry/src/lib.rs b/services/mgmt/containerregistry/src/lib.rs index 4ba4fb18fa..1751fc897f 100644 --- a/services/mgmt/containerregistry/src/lib.rs +++ b/services/mgmt/containerregistry/src/lib.rs @@ -3,6 +3,14 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-09-only")] +pub mod package_2021_09_only; +#[cfg(all(feature = "package-2021-09-only", not(feature = "no-default-version")))] +pub use package_2021_09_only::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-09")] +pub mod package_2021_09; +#[cfg(all(feature = "package-2021-09", not(feature = "no-default-version")))] +pub use package_2021_09::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-08-preview-only")] pub mod package_2021_08_preview_only; #[cfg(all(feature = "package-2021-08-preview-only", not(feature = "no-default-version")))] diff --git a/services/mgmt/containerregistry/src/package_2019_06_preview/models.rs b/services/mgmt/containerregistry/src/package_2019_06_preview/models.rs index 7c346068c8..2b8399cb16 100644 --- a/services/mgmt/containerregistry/src/package_2019_06_preview/models.rs +++ b/services/mgmt/containerregistry/src/package_2019_06_preview/models.rs @@ -347,8 +347,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Event { diff --git a/services/mgmt/containerregistry/src/package_2019_06_preview_only/models.rs b/services/mgmt/containerregistry/src/package_2019_06_preview_only/models.rs index 15a963b74c..fbbd321661 100644 --- a/services/mgmt/containerregistry/src/package_2019_06_preview_only/models.rs +++ b/services/mgmt/containerregistry/src/package_2019_06_preview_only/models.rs @@ -328,8 +328,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct FileTaskRunRequest { diff --git a/services/mgmt/containerregistry/src/package_2019_12_preview/models.rs b/services/mgmt/containerregistry/src/package_2019_12_preview/models.rs index daf30841e9..32cabb1a03 100644 --- a/services/mgmt/containerregistry/src/package_2019_12_preview/models.rs +++ b/services/mgmt/containerregistry/src/package_2019_12_preview/models.rs @@ -364,8 +364,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Event { diff --git a/services/mgmt/containerregistry/src/package_2020_11_preview/models.rs b/services/mgmt/containerregistry/src/package_2020_11_preview/models.rs index 6c72459c47..6bbe4d00f4 100644 --- a/services/mgmt/containerregistry/src/package_2020_11_preview/models.rs +++ b/services/mgmt/containerregistry/src/package_2020_11_preview/models.rs @@ -452,8 +452,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Event { diff --git a/services/mgmt/containerregistry/src/package_2020_11_preview_only/models.rs b/services/mgmt/containerregistry/src/package_2020_11_preview_only/models.rs index afd5e86321..e951e54046 100644 --- a/services/mgmt/containerregistry/src/package_2020_11_preview_only/models.rs +++ b/services/mgmt/containerregistry/src/package_2020_11_preview_only/models.rs @@ -137,8 +137,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Event { diff --git a/services/mgmt/containerregistry/src/package_2021_06_preview/models.rs b/services/mgmt/containerregistry/src/package_2021_06_preview/models.rs index 6d58233a09..77170d43e3 100644 --- a/services/mgmt/containerregistry/src/package_2021_06_preview/models.rs +++ b/services/mgmt/containerregistry/src/package_2021_06_preview/models.rs @@ -452,8 +452,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Event { diff --git a/services/mgmt/containerregistry/src/package_2021_06_preview_only/models.rs b/services/mgmt/containerregistry/src/package_2021_06_preview_only/models.rs index a927a2e45a..fc482d12af 100644 --- a/services/mgmt/containerregistry/src/package_2021_06_preview_only/models.rs +++ b/services/mgmt/containerregistry/src/package_2021_06_preview_only/models.rs @@ -137,8 +137,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Event { diff --git a/services/mgmt/containerregistry/src/package_2021_08_preview/models.rs b/services/mgmt/containerregistry/src/package_2021_08_preview/models.rs index 2fea811f2d..25a8604286 100644 --- a/services/mgmt/containerregistry/src/package_2021_08_preview/models.rs +++ b/services/mgmt/containerregistry/src/package_2021_08_preview/models.rs @@ -458,8 +458,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Event { diff --git a/services/mgmt/containerregistry/src/package_2021_08_preview_only/models.rs b/services/mgmt/containerregistry/src/package_2021_08_preview_only/models.rs index d7ebc872b3..30f395ee21 100644 --- a/services/mgmt/containerregistry/src/package_2021_08_preview_only/models.rs +++ b/services/mgmt/containerregistry/src/package_2021_08_preview_only/models.rs @@ -143,8 +143,8 @@ pub struct ErrorResponseBody { pub message: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Event { diff --git a/services/mgmt/containerregistry/src/package_2021_09/mod.rs b/services/mgmt/containerregistry/src/package_2021_09/mod.rs new file mode 100644 index 0000000000..aef56ba7eb --- /dev/null +++ b/services/mgmt/containerregistry/src/package_2021_09/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-09-01"; diff --git a/services/mgmt/containerregistry/src/package_2021_09/models.rs b/services/mgmt/containerregistry/src/package_2021_09/models.rs new file mode 100644 index 0000000000..d028713971 --- /dev/null +++ b/services/mgmt/containerregistry/src/package_2021_09/models.rs @@ -0,0 +1,1979 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Actor { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPool { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub os: Option, + #[serde(rename = "virtualNetworkSubnetResourceId", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_subnet_resource_id: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod agent_pool_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Os { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolPropertiesUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolQueueStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Argument { + pub name: String, + pub value: String, + #[serde(rename = "isSecret", default, skip_serializing_if = "Option::is_none")] + pub is_secret: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthInfo { + #[serde(rename = "tokenType")] + pub token_type: auth_info::TokenType, + pub token: String, + #[serde(rename = "refreshToken", default, skip_serializing_if = "Option::is_none")] + pub refresh_token: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[serde(rename = "expiresIn", default, skip_serializing_if = "Option::is_none")] + pub expires_in: Option, +} +pub mod auth_info { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TokenType { + #[serde(rename = "PAT")] + Pat, + OAuth, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthInfoUpdateParameters { + #[serde(rename = "tokenType", default, skip_serializing_if = "Option::is_none")] + pub token_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub token: Option, + #[serde(rename = "refreshToken", default, skip_serializing_if = "Option::is_none")] + pub refresh_token: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[serde(rename = "expiresIn", default, skip_serializing_if = "Option::is_none")] + pub expires_in: Option, +} +pub mod auth_info_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TokenType { + #[serde(rename = "PAT")] + Pat, + OAuth, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BaseImageDependency { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub registry: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub digest: Option, +} +pub mod base_image_dependency { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + BuildTime, + RunTime, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BaseImageTrigger { + #[serde(rename = "baseImageTriggerType")] + pub base_image_trigger_type: base_image_trigger::BaseImageTriggerType, + #[serde(rename = "updateTriggerEndpoint", default, skip_serializing_if = "Option::is_none")] + pub update_trigger_endpoint: Option, + #[serde(rename = "updateTriggerPayloadType", default, skip_serializing_if = "Option::is_none")] + pub update_trigger_payload_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + pub name: String, +} +pub mod base_image_trigger { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BaseImageTriggerType { + All, + Runtime, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpdateTriggerPayloadType { + Default, + Token, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BaseImageTriggerUpdateParameters { + #[serde(rename = "baseImageTriggerType", default, skip_serializing_if = "Option::is_none")] + pub base_image_trigger_type: Option, + #[serde(rename = "updateTriggerEndpoint", default, skip_serializing_if = "Option::is_none")] + pub update_trigger_endpoint: Option, + #[serde(rename = "updateTriggerPayloadType", default, skip_serializing_if = "Option::is_none")] + pub update_trigger_payload_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + pub name: String, +} +pub mod base_image_trigger_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BaseImageTriggerType { + All, + Runtime, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpdateTriggerPayloadType { + Default, + Token, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CallbackConfig { + #[serde(rename = "serviceUri")] + pub service_uri: String, + #[serde(rename = "customHeaders", default, skip_serializing_if = "Option::is_none")] + pub custom_headers: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Credentials { + #[serde(rename = "sourceRegistry", default, skip_serializing_if = "Option::is_none")] + pub source_registry: Option, + #[serde(rename = "customRegistries", default, skip_serializing_if = "Option::is_none")] + pub custom_registries: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomRegistryCredentials { + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DockerBuildRequest { + #[serde(flatten)] + pub run_request: RunRequest, + #[serde(rename = "imageNames", default, skip_serializing_if = "Vec::is_empty")] + pub image_names: Vec, + #[serde(rename = "isPushEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_push_enabled: Option, + #[serde(rename = "noCache", default, skip_serializing_if = "Option::is_none")] + pub no_cache: Option, + #[serde(rename = "dockerFilePath")] + pub docker_file_path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub arguments: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + pub platform: PlatformProperties, + #[serde(rename = "agentConfiguration", default, skip_serializing_if = "Option::is_none")] + pub agent_configuration: Option, + #[serde(rename = "sourceLocation", default, skip_serializing_if = "Option::is_none")] + pub source_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DockerBuildStep { + #[serde(flatten)] + pub task_step_properties: TaskStepProperties, + #[serde(rename = "imageNames", default, skip_serializing_if = "Vec::is_empty")] + pub image_names: Vec, + #[serde(rename = "isPushEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_push_enabled: Option, + #[serde(rename = "noCache", default, skip_serializing_if = "Option::is_none")] + pub no_cache: Option, + #[serde(rename = "dockerFilePath")] + pub docker_file_path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub arguments: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DockerBuildStepUpdateParameters { + #[serde(flatten)] + pub task_step_update_parameters: TaskStepUpdateParameters, + #[serde(rename = "imageNames", default, skip_serializing_if = "Vec::is_empty")] + pub image_names: Vec, + #[serde(rename = "isPushEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_push_enabled: Option, + #[serde(rename = "noCache", default, skip_serializing_if = "Option::is_none")] + pub no_cache: Option, + #[serde(rename = "dockerFilePath", default, skip_serializing_if = "Option::is_none")] + pub docker_file_path: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub arguments: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncodedTaskRunRequest { + #[serde(flatten)] + pub run_request: RunRequest, + #[serde(rename = "encodedTaskContent")] + pub encoded_task_content: String, + #[serde(rename = "encodedValuesContent", default, skip_serializing_if = "Option::is_none")] + pub encoded_values_content: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + pub platform: PlatformProperties, + #[serde(rename = "agentConfiguration", default, skip_serializing_if = "Option::is_none")] + pub agent_configuration: Option, + #[serde(rename = "sourceLocation", default, skip_serializing_if = "Option::is_none")] + pub source_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncodedTaskStep { + #[serde(flatten)] + pub task_step_properties: TaskStepProperties, + #[serde(rename = "encodedTaskContent")] + pub encoded_task_content: String, + #[serde(rename = "encodedValuesContent", default, skip_serializing_if = "Option::is_none")] + pub encoded_values_content: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncodedTaskStepUpdateParameters { + #[serde(flatten)] + pub task_step_update_parameters: TaskStepUpdateParameters, + #[serde(rename = "encodedTaskContent", default, skip_serializing_if = "Option::is_none")] + pub encoded_task_content: Option, + #[serde(rename = "encodedValuesContent", default, skip_serializing_if = "Option::is_none")] + pub encoded_values_content: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionProperty { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] + pub key_vault_properties: Option, +} +pub mod encryption_property { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponseBody { + pub code: String, + pub message: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Event { + #[serde(flatten)] + pub event_info: EventInfo, + #[serde(rename = "eventRequestMessage", default, skip_serializing_if = "Option::is_none")] + pub event_request_message: Option, + #[serde(rename = "eventResponseMessage", default, skip_serializing_if = "Option::is_none")] + pub event_response_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventContent { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub request: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub actor: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventRequestMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[serde(rename = "requestUri", default, skip_serializing_if = "Option::is_none")] + pub request_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventResponseMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[serde(rename = "reasonPhrase", default, skip_serializing_if = "Option::is_none")] + pub reason_phrase: Option, + #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] + pub status_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportPolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod export_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileTaskRunRequest { + #[serde(flatten)] + pub run_request: RunRequest, + #[serde(rename = "taskFilePath")] + pub task_file_path: String, + #[serde(rename = "valuesFilePath", default, skip_serializing_if = "Option::is_none")] + pub values_file_path: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + pub platform: PlatformProperties, + #[serde(rename = "agentConfiguration", default, skip_serializing_if = "Option::is_none")] + pub agent_configuration: Option, + #[serde(rename = "sourceLocation", default, skip_serializing_if = "Option::is_none")] + pub source_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileTaskStep { + #[serde(flatten)] + pub task_step_properties: TaskStepProperties, + #[serde(rename = "taskFilePath")] + pub task_file_path: String, + #[serde(rename = "valuesFilePath", default, skip_serializing_if = "Option::is_none")] + pub values_file_path: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileTaskStepUpdateParameters { + #[serde(flatten)] + pub task_step_update_parameters: TaskStepUpdateParameters, + #[serde(rename = "taskFilePath", default, skip_serializing_if = "Option::is_none")] + pub task_file_path: Option, + #[serde(rename = "valuesFilePath", default, skip_serializing_if = "Option::is_none")] + pub values_file_path: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpRule { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + pub value: String, +} +pub mod ip_rule { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Action { + Allow, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProperties { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod identity_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageDescriptor { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub registry: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub digest: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageUpdateTrigger { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub images: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportImageParameters { + pub source: ImportSource, + #[serde(rename = "targetTags", default, skip_serializing_if = "Vec::is_empty")] + pub target_tags: Vec, + #[serde(rename = "untaggedTargetRepositories", default, skip_serializing_if = "Vec::is_empty")] + pub untagged_target_repositories: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, +} +pub mod import_image_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + NoForce, + Force, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportSource { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "registryUri", default, skip_serializing_if = "Option::is_none")] + pub registry_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + #[serde(rename = "sourceImage")] + pub source_image: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportSourceCredentials { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + pub password: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InnerErrorDescription { + pub code: String, + pub message: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultProperties { + #[serde(rename = "keyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub key_identifier: Option, + #[serde(rename = "versionedKeyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub versioned_key_identifier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(rename = "keyRotationEnabled", default, skip_serializing_if = "Option::is_none")] + pub key_rotation_enabled: Option, + #[serde(rename = "lastKeyRotationTimestamp", default, skip_serializing_if = "Option::is_none")] + pub last_key_rotation_timestamp: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkRuleSet { + #[serde(rename = "defaultAction")] + pub default_action: network_rule_set::DefaultAction, + #[serde(rename = "ipRules", default, skip_serializing_if = "Vec::is_empty")] + pub ip_rules: Vec, +} +pub mod network_rule_set { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DefaultAction { + Allow, + Deny, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDisplayDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationLogSpecificationDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationMetricSpecificationDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[serde(rename = "internalMetricName", default, skip_serializing_if = "Option::is_none")] + pub internal_metric_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationPropertiesDefinition { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationServiceSpecificationDefinition { + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OverrideTaskStepProperties { + #[serde(rename = "contextPath", default, skip_serializing_if = "Option::is_none")] + pub context_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub file: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub arguments: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, + #[serde(rename = "updateTriggerToken", default, skip_serializing_if = "Option::is_none")] + pub update_trigger_token: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PackageType { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PlatformProperties { + pub os: platform_properties::Os, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub architecture: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub variant: Option, +} +pub mod platform_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Os { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Architecture { + #[serde(rename = "amd64")] + Amd64, + #[serde(rename = "x86")] + X86, + #[serde(rename = "386")] + N386, + #[serde(rename = "arm")] + Arm, + #[serde(rename = "arm64")] + Arm64, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Variant { + #[serde(rename = "v6")] + V6, + #[serde(rename = "v7")] + V7, + #[serde(rename = "v8")] + V8, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PlatformUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub os: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub architecture: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub variant: Option, +} +pub mod platform_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Os { + Windows, + Linux, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Architecture { + #[serde(rename = "amd64")] + Amd64, + #[serde(rename = "x86")] + X86, + #[serde(rename = "386")] + N386, + #[serde(rename = "arm")] + Arm, + #[serde(rename = "arm64")] + Arm64, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Variant { + #[serde(rename = "v6")] + V6, + #[serde(rename = "v7")] + V7, + #[serde(rename = "v8")] + V8, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Policies { + #[serde(rename = "quarantinePolicy", default, skip_serializing_if = "Option::is_none")] + pub quarantine_policy: Option, + #[serde(rename = "trustPolicy", default, skip_serializing_if = "Option::is_none")] + pub trust_policy: Option, + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, + #[serde(rename = "exportPolicy", default, skip_serializing_if = "Option::is_none")] + pub export_policy: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod private_endpoint_connection_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceProperties { + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Approved, + Pending, + Rejected, + Disconnected, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionsRequired { + None, + Recreate, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuarantinePolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod quarantine_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegenerateCredentialParameters { + pub name: regenerate_credential_parameters::Name, +} +pub mod regenerate_credential_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "password")] + Password, + #[serde(rename = "password2")] + Password2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Registry { + #[serde(flatten)] + pub resource: Resource, + pub sku: Sku, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryListCredentialsResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub passwords: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryNameCheckRequest { + pub name: String, + #[serde(rename = "type")] + pub type_: registry_name_check_request::Type, +} +pub mod registry_name_check_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "Microsoft.ContainerRegistry/registries")] + MicrosoftContainerRegistryRegistries, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryNameStatus { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryPassword { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +pub mod registry_password { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "password")] + Password, + #[serde(rename = "password2")] + Password2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryProperties { + #[serde(rename = "loginServer", default, skip_serializing_if = "Option::is_none")] + pub login_server: Option, + #[serde(rename = "creationDate", default, skip_serializing_if = "Option::is_none")] + pub creation_date: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "adminUserEnabled", default, skip_serializing_if = "Option::is_none")] + pub admin_user_enabled: Option, + #[serde(rename = "networkRuleSet", default, skip_serializing_if = "Option::is_none")] + pub network_rule_set: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub policies: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "dataEndpointEnabled", default, skip_serializing_if = "Option::is_none")] + pub data_endpoint_enabled: Option, + #[serde(rename = "dataEndpointHostNames", default, skip_serializing_if = "Vec::is_empty")] + pub data_endpoint_host_names: Vec, + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "networkRuleBypassOptions", default, skip_serializing_if = "Option::is_none")] + pub network_rule_bypass_options: Option, + #[serde(rename = "zoneRedundancy", default, skip_serializing_if = "Option::is_none")] + pub zone_redundancy: Option, +} +pub mod registry_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkRuleBypassOptions { + AzureServices, + None, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ZoneRedundancy { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryPropertiesUpdateParameters { + #[serde(rename = "adminUserEnabled", default, skip_serializing_if = "Option::is_none")] + pub admin_user_enabled: Option, + #[serde(rename = "networkRuleSet", default, skip_serializing_if = "Option::is_none")] + pub network_rule_set: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub policies: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "dataEndpointEnabled", default, skip_serializing_if = "Option::is_none")] + pub data_endpoint_enabled: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "networkRuleBypassOptions", default, skip_serializing_if = "Option::is_none")] + pub network_rule_bypass_options: Option, +} +pub mod registry_properties_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkRuleBypassOptions { + AzureServices, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryUsage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, +} +pub mod registry_usage { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryUsageListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Replication { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "regionEndpointEnabled", default, skip_serializing_if = "Option::is_none")] + pub region_endpoint_enabled: Option, + #[serde(rename = "zoneRedundancy", default, skip_serializing_if = "Option::is_none")] + pub zone_redundancy: Option, +} +pub mod replication_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ZoneRedundancy { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationUpdateParametersProperties { + #[serde(rename = "regionEndpointEnabled", default, skip_serializing_if = "Option::is_none")] + pub region_endpoint_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Request { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub addr: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub useragent: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionPolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub days: Option, + #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod retention_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Run { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunFilter { + #[serde(rename = "runId", default, skip_serializing_if = "Option::is_none")] + pub run_id: Option, + #[serde(rename = "runType", default, skip_serializing_if = "Option::is_none")] + pub run_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[serde(rename = "finishTime", default, skip_serializing_if = "Option::is_none")] + pub finish_time: Option, + #[serde(rename = "outputImageManifests", default, skip_serializing_if = "Option::is_none")] + pub output_image_manifests: Option, + #[serde(rename = "isArchiveEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_archive_enabled: Option, + #[serde(rename = "taskName", default, skip_serializing_if = "Option::is_none")] + pub task_name: Option, + #[serde(rename = "agentPoolName", default, skip_serializing_if = "Option::is_none")] + pub agent_pool_name: Option, +} +pub mod run_filter { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RunType { + QuickBuild, + QuickRun, + AutoBuild, + AutoRun, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Queued, + Started, + Running, + Succeeded, + Failed, + Canceled, + Error, + Timeout, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunGetLogResult { + #[serde(rename = "logLink", default, skip_serializing_if = "Option::is_none")] + pub log_link: Option, + #[serde(rename = "logArtifactLink", default, skip_serializing_if = "Option::is_none")] + pub log_artifact_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunProperties { + #[serde(rename = "runId", default, skip_serializing_if = "Option::is_none")] + pub run_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time: Option, + #[serde(rename = "runType", default, skip_serializing_if = "Option::is_none")] + pub run_type: Option, + #[serde(rename = "agentPoolName", default, skip_serializing_if = "Option::is_none")] + pub agent_pool_name: Option, + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "finishTime", default, skip_serializing_if = "Option::is_none")] + pub finish_time: Option, + #[serde(rename = "outputImages", default, skip_serializing_if = "Vec::is_empty")] + pub output_images: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub task: Option, + #[serde(rename = "imageUpdateTrigger", default, skip_serializing_if = "Option::is_none")] + pub image_update_trigger: Option, + #[serde(rename = "sourceTrigger", default, skip_serializing_if = "Option::is_none")] + pub source_trigger: Option, + #[serde(rename = "timerTrigger", default, skip_serializing_if = "Option::is_none")] + pub timer_trigger: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub platform: Option, + #[serde(rename = "agentConfiguration", default, skip_serializing_if = "Option::is_none")] + pub agent_configuration: Option, + #[serde(rename = "sourceRegistryAuth", default, skip_serializing_if = "Option::is_none")] + pub source_registry_auth: Option, + #[serde(rename = "customRegistries", default, skip_serializing_if = "Vec::is_empty")] + pub custom_registries: Vec, + #[serde(rename = "runErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub run_error_message: Option, + #[serde(rename = "updateTriggerToken", default, skip_serializing_if = "Option::is_none")] + pub update_trigger_token: Option, + #[serde(rename = "logArtifact", default, skip_serializing_if = "Option::is_none")] + pub log_artifact: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "isArchiveEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_archive_enabled: Option, +} +pub mod run_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Queued, + Started, + Running, + Succeeded, + Failed, + Canceled, + Error, + Timeout, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RunType { + QuickBuild, + QuickRun, + AutoBuild, + AutoRun, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunRequest { + #[serde(rename = "type")] + pub type_: String, + #[serde(rename = "isArchiveEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_archive_enabled: Option, + #[serde(rename = "agentPoolName", default, skip_serializing_if = "Option::is_none")] + pub agent_pool_name: Option, + #[serde(rename = "logTemplate", default, skip_serializing_if = "Option::is_none")] + pub log_template: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunUpdateParameters { + #[serde(rename = "isArchiveEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_archive_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod secret_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Opaque, + Vaultsecret, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SetValue { + pub name: String, + pub value: String, + #[serde(rename = "isSecret", default, skip_serializing_if = "Option::is_none")] + pub is_secret: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + pub name: sku::Name, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Classic, + Basic, + Standard, + Premium, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Classic, + Basic, + Standard, + Premium, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Source { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub addr: Option, + #[serde(rename = "instanceID", default, skip_serializing_if = "Option::is_none")] + pub instance_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceProperties { + #[serde(rename = "sourceControlType")] + pub source_control_type: source_properties::SourceControlType, + #[serde(rename = "repositoryUrl")] + pub repository_url: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[serde(rename = "sourceControlAuthProperties", default, skip_serializing_if = "Option::is_none")] + pub source_control_auth_properties: Option, +} +pub mod source_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceControlType { + Github, + VisualStudioTeamService, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceRegistryCredentials { + #[serde(rename = "loginMode", default, skip_serializing_if = "Option::is_none")] + pub login_mode: Option, +} +pub mod source_registry_credentials { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoginMode { + None, + Default, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceTrigger { + #[serde(rename = "sourceRepository")] + pub source_repository: SourceProperties, + #[serde(rename = "sourceTriggerEvents")] + pub source_trigger_events: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + pub name: String, +} +pub mod source_trigger { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceTriggerDescriptor { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "eventType", default, skip_serializing_if = "Option::is_none")] + pub event_type: Option, + #[serde(rename = "commitId", default, skip_serializing_if = "Option::is_none")] + pub commit_id: Option, + #[serde(rename = "pullRequestId", default, skip_serializing_if = "Option::is_none")] + pub pull_request_id: Option, + #[serde(rename = "repositoryUrl", default, skip_serializing_if = "Option::is_none")] + pub repository_url: Option, + #[serde(rename = "branchName", default, skip_serializing_if = "Option::is_none")] + pub branch_name: Option, + #[serde(rename = "providerType", default, skip_serializing_if = "Option::is_none")] + pub provider_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceTriggerUpdateParameters { + #[serde(rename = "sourceRepository", default, skip_serializing_if = "Option::is_none")] + pub source_repository: Option, + #[serde(rename = "sourceTriggerEvents", default, skip_serializing_if = "Vec::is_empty")] + pub source_trigger_events: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + pub name: String, +} +pub mod source_trigger_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceUpdateParameters { + #[serde(rename = "sourceControlType", default, skip_serializing_if = "Option::is_none")] + pub source_control_type: Option, + #[serde(rename = "repositoryUrl", default, skip_serializing_if = "Option::is_none")] + pub repository_url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[serde(rename = "sourceControlAuthProperties", default, skip_serializing_if = "Option::is_none")] + pub source_control_auth_properties: Option, +} +pub mod source_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceControlType { + Github, + VisualStudioTeamService, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceUploadDefinition { + #[serde(rename = "uploadUrl", default, skip_serializing_if = "Option::is_none")] + pub upload_url: Option, + #[serde(rename = "relativePath", default, skip_serializing_if = "Option::is_none")] + pub relative_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Status { + #[serde(rename = "displayStatus", default, skip_serializing_if = "Option::is_none")] + pub display_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccountProperties { + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Target { + #[serde(rename = "mediaType", default, skip_serializing_if = "Option::is_none")] + pub media_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub digest: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub length: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Task { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "creationDate", default, skip_serializing_if = "Option::is_none")] + pub creation_date: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub platform: Option, + #[serde(rename = "agentConfiguration", default, skip_serializing_if = "Option::is_none")] + pub agent_configuration: Option, + #[serde(rename = "agentPoolName", default, skip_serializing_if = "Option::is_none")] + pub agent_pool_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub step: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub trigger: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + #[serde(rename = "logTemplate", default, skip_serializing_if = "Option::is_none")] + pub log_template: Option, + #[serde(rename = "isSystemTask", default, skip_serializing_if = "Option::is_none")] + pub is_system_task: Option, +} +pub mod task_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskPropertiesUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub platform: Option, + #[serde(rename = "agentConfiguration", default, skip_serializing_if = "Option::is_none")] + pub agent_configuration: Option, + #[serde(rename = "agentPoolName", default, skip_serializing_if = "Option::is_none")] + pub agent_pool_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub step: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub trigger: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + #[serde(rename = "logTemplate", default, skip_serializing_if = "Option::is_none")] + pub log_template: Option, +} +pub mod task_properties_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskRun { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskRunListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskRunProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "runRequest", default, skip_serializing_if = "Option::is_none")] + pub run_request: Option, + #[serde(rename = "runResult", default, skip_serializing_if = "Option::is_none")] + pub run_result: Option, + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, +} +pub mod task_run_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskRunPropertiesUpdateParameters { + #[serde(rename = "runRequest", default, skip_serializing_if = "Option::is_none")] + pub run_request: Option, + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskRunRequest { + #[serde(flatten)] + pub run_request: RunRequest, + #[serde(rename = "taskId")] + pub task_id: String, + #[serde(rename = "overrideTaskStepProperties", default, skip_serializing_if = "Option::is_none")] + pub override_task_step_properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskRunUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskStepProperties { + #[serde(rename = "type")] + pub type_: task_step_properties::Type, + #[serde(rename = "baseImageDependencies", default, skip_serializing_if = "Vec::is_empty")] + pub base_image_dependencies: Vec, + #[serde(rename = "contextPath", default, skip_serializing_if = "Option::is_none")] + pub context_path: Option, + #[serde(rename = "contextAccessToken", default, skip_serializing_if = "Option::is_none")] + pub context_access_token: Option, +} +pub mod task_step_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Docker, + FileTask, + EncodedTask, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskStepUpdateParameters { + #[serde(rename = "type")] + pub type_: task_step_update_parameters::Type, + #[serde(rename = "contextPath", default, skip_serializing_if = "Option::is_none")] + pub context_path: Option, + #[serde(rename = "contextAccessToken", default, skip_serializing_if = "Option::is_none")] + pub context_access_token: Option, +} +pub mod task_step_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Docker, + FileTask, + EncodedTask, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimerTrigger { + pub schedule: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + pub name: String, +} +pub mod timer_trigger { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimerTriggerDescriptor { + #[serde(rename = "timerTriggerName", default, skip_serializing_if = "Option::is_none")] + pub timer_trigger_name: Option, + #[serde(rename = "scheduleOccurrence", default, skip_serializing_if = "Option::is_none")] + pub schedule_occurrence: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimerTriggerUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schedule: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + pub name: String, +} +pub mod timer_trigger_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerProperties { + #[serde(rename = "timerTriggers", default, skip_serializing_if = "Vec::is_empty")] + pub timer_triggers: Vec, + #[serde(rename = "sourceTriggers", default, skip_serializing_if = "Vec::is_empty")] + pub source_triggers: Vec, + #[serde(rename = "baseImageTrigger", default, skip_serializing_if = "Option::is_none")] + pub base_image_trigger: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerUpdateParameters { + #[serde(rename = "timerTriggers", default, skip_serializing_if = "Vec::is_empty")] + pub timer_triggers: Vec, + #[serde(rename = "sourceTriggers", default, skip_serializing_if = "Vec::is_empty")] + pub source_triggers: Vec, + #[serde(rename = "baseImageTrigger", default, skip_serializing_if = "Option::is_none")] + pub base_image_trigger: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrustPolicy { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod trust_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Notary, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserIdentityProperties { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Webhook { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookCreateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + pub actions: Vec, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod webhook_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookPropertiesCreateParameters { + #[serde(rename = "serviceUri")] + pub service_uri: String, + #[serde(rename = "customHeaders", default, skip_serializing_if = "Option::is_none")] + pub custom_headers: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + pub actions: Vec, +} +pub mod webhook_properties_create_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookPropertiesUpdateParameters { + #[serde(rename = "serviceUri", default, skip_serializing_if = "Option::is_none")] + pub service_uri: Option, + #[serde(rename = "customHeaders", default, skip_serializing_if = "Option::is_none")] + pub custom_headers: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, +} +pub mod webhook_properties_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} diff --git a/services/mgmt/containerregistry/src/package_2021_09/operations.rs b/services/mgmt/containerregistry/src/package_2021_09/operations.rs new file mode 100644 index 0000000000..4ce3e04ec2 --- /dev/null +++ b/services/mgmt/containerregistry/src/package_2021_09/operations.rs @@ -0,0 +1,5503 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn agent_pools(&self) -> agent_pools::Client { + agent_pools::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn registries(&self) -> registries::Client { + registries::Client(self.clone()) + } + pub fn replications(&self) -> replications::Client { + replications::Client(self.clone()) + } + pub fn runs(&self) -> runs::Client { + runs::Client(self.clone()) + } + pub fn task_runs(&self) -> task_runs::Client { + task_runs::Client(self.clone()) + } + pub fn tasks(&self) -> tasks::Client { + tasks::Client(self.clone()) + } + pub fn webhooks(&self) -> webhooks::Client { + webhooks::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Registries_ImportImage(#[from] registries::import_image::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Registries_CheckNameAvailability(#[from] registries::check_name_availability::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_CreateOrUpdate(#[from] private_endpoint_connections::create_or_update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + Registries_List(#[from] registries::list::Error), + #[error(transparent)] + Registries_ListByResourceGroup(#[from] registries::list_by_resource_group::Error), + #[error(transparent)] + Registries_Get(#[from] registries::get::Error), + #[error(transparent)] + Registries_Create(#[from] registries::create::Error), + #[error(transparent)] + Registries_Update(#[from] registries::update::Error), + #[error(transparent)] + Registries_Delete(#[from] registries::delete::Error), + #[error(transparent)] + Registries_ListUsages(#[from] registries::list_usages::Error), + #[error(transparent)] + Registries_ListPrivateLinkResources(#[from] registries::list_private_link_resources::Error), + #[error(transparent)] + Registries_GetPrivateLinkResource(#[from] registries::get_private_link_resource::Error), + #[error(transparent)] + Registries_ListCredentials(#[from] registries::list_credentials::Error), + #[error(transparent)] + Registries_RegenerateCredential(#[from] registries::regenerate_credential::Error), + #[error(transparent)] + Replications_List(#[from] replications::list::Error), + #[error(transparent)] + Replications_Get(#[from] replications::get::Error), + #[error(transparent)] + Replications_Create(#[from] replications::create::Error), + #[error(transparent)] + Replications_Update(#[from] replications::update::Error), + #[error(transparent)] + Replications_Delete(#[from] replications::delete::Error), + #[error(transparent)] + Webhooks_List(#[from] webhooks::list::Error), + #[error(transparent)] + Webhooks_Get(#[from] webhooks::get::Error), + #[error(transparent)] + Webhooks_Create(#[from] webhooks::create::Error), + #[error(transparent)] + Webhooks_Update(#[from] webhooks::update::Error), + #[error(transparent)] + Webhooks_Delete(#[from] webhooks::delete::Error), + #[error(transparent)] + Webhooks_Ping(#[from] webhooks::ping::Error), + #[error(transparent)] + Webhooks_ListEvents(#[from] webhooks::list_events::Error), + #[error(transparent)] + Webhooks_GetCallbackConfig(#[from] webhooks::get_callback_config::Error), + #[error(transparent)] + AgentPools_Get(#[from] agent_pools::get::Error), + #[error(transparent)] + AgentPools_Create(#[from] agent_pools::create::Error), + #[error(transparent)] + AgentPools_Update(#[from] agent_pools::update::Error), + #[error(transparent)] + AgentPools_Delete(#[from] agent_pools::delete::Error), + #[error(transparent)] + AgentPools_List(#[from] agent_pools::list::Error), + #[error(transparent)] + AgentPools_GetQueueStatus(#[from] agent_pools::get_queue_status::Error), + #[error(transparent)] + Registries_ScheduleRun(#[from] registries::schedule_run::Error), + #[error(transparent)] + Registries_GetBuildSourceUploadUrl(#[from] registries::get_build_source_upload_url::Error), + #[error(transparent)] + Runs_List(#[from] runs::list::Error), + #[error(transparent)] + Runs_Get(#[from] runs::get::Error), + #[error(transparent)] + Runs_Update(#[from] runs::update::Error), + #[error(transparent)] + Runs_GetLogSasUrl(#[from] runs::get_log_sas_url::Error), + #[error(transparent)] + Runs_Cancel(#[from] runs::cancel::Error), + #[error(transparent)] + TaskRuns_Get(#[from] task_runs::get::Error), + #[error(transparent)] + TaskRuns_Create(#[from] task_runs::create::Error), + #[error(transparent)] + TaskRuns_Update(#[from] task_runs::update::Error), + #[error(transparent)] + TaskRuns_Delete(#[from] task_runs::delete::Error), + #[error(transparent)] + TaskRuns_GetDetails(#[from] task_runs::get_details::Error), + #[error(transparent)] + TaskRuns_List(#[from] task_runs::list::Error), + #[error(transparent)] + Tasks_List(#[from] tasks::list::Error), + #[error(transparent)] + Tasks_Get(#[from] tasks::get::Error), + #[error(transparent)] + Tasks_Create(#[from] tasks::create::Error), + #[error(transparent)] + Tasks_Update(#[from] tasks::update::Error), + #[error(transparent)] + Tasks_Delete(#[from] tasks::delete::Error), + #[error(transparent)] + Tasks_GetDetails(#[from] tasks::get_details::Error), +} +pub mod registries { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn import_image( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + parameters: impl Into, + ) -> import_image::Builder { + import_image::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + parameters: parameters.into(), + } + } + pub fn check_name_availability( + &self, + subscription_id: impl Into, + registry_name_check_request: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + registry_name_check_request: registry_name_check_request.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + registry: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + registry: registry.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + registry_update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + registry_update_parameters: registry_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn list_usages( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list_usages::Builder { + list_usages::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn list_private_link_resources( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list_private_link_resources::Builder { + list_private_link_resources::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get_private_link_resource( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + group_name: impl Into, + ) -> get_private_link_resource::Builder { + get_private_link_resource::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + group_name: group_name.into(), + } + } + pub fn list_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list_credentials::Builder { + list_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn regenerate_credential( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + regenerate_credential_parameters: impl Into, + ) -> regenerate_credential::Builder { + regenerate_credential::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + regenerate_credential_parameters: regenerate_credential_parameters.into(), + } + } + pub fn schedule_run( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + run_request: impl Into, + ) -> schedule_run::Builder { + schedule_run::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + run_request: run_request.into(), + } + } + pub fn get_build_source_upload_url( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> get_build_source_upload_url::Builder { + get_build_source_upload_url::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + } + pub mod import_image { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) parameters: models::ImportImageParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/importImage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) registry_name_check_request: models::RegistryNameCheckRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerRegistry/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.registry_name_check_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryNameStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerRegistry/registries", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Registry), + Created201(models::Registry), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) registry: models::Registry, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.registry).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Registry), + Created201(models::Registry), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) registry_update_parameters: models::RegistryUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.registry_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_usages { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/listUsages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryUsageListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_private_link_resources { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_private_link_resource { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/listCredentials", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryListCredentialsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod regenerate_credential { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) regenerate_credential_parameters: models::RegenerateCredentialParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/regenerateCredential", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.regenerate_credential_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryListCredentialsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod schedule_run { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Run), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) run_request: models::RunRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/scheduleRun", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.run_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Run = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_build_source_upload_url { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/listBuildSourceUploadUrl" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceUploadDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerRegistry/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + private_endpoint_connection_name: impl Into, + private_endpoint_connection: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + private_endpoint_connection: private_endpoint_connection.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnection), + Created201(models::PrivateEndpointConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) private_endpoint_connection: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.private_endpoint_connection).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replications { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + replication_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + replication_name: replication_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + replication_name: impl Into, + replication: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + replication_name: replication_name.into(), + replication: replication.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + replication_name: impl Into, + replication_update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + replication_name: replication_name.into(), + replication_update_parameters: replication_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + replication_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + replication_name: replication_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) replication_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.replication_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Replication), + Created201(models::Replication), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) replication_name: String, + pub(crate) replication: models::Replication, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.replication_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.replication).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Replication), + Created201(models::Replication), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) replication_name: String, + pub(crate) replication_update_parameters: models::ReplicationUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.replication_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.replication_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) replication_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.replication_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod webhooks { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + webhook_create_parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + webhook_create_parameters: webhook_create_parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + webhook_update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + webhook_update_parameters: webhook_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + pub fn ping( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> ping::Builder { + ping::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + pub fn list_events( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> list_events::Builder { + list_events::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + pub fn get_callback_config( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> get_callback_config::Builder { + get_callback_config::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WebhookListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Webhook), + Created201(models::Webhook), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + pub(crate) webhook_create_parameters: models::WebhookCreateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.webhook_create_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Webhook), + Created201(models::Webhook), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + pub(crate) webhook_update_parameters: models::WebhookUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.webhook_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod ping { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}/ping", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EventInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_events { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}/listEvents", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EventListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_callback_config { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}/getCallbackConfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . webhook_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CallbackConfig = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod agent_pools { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + agent_pool_name: impl Into, + agent_pool: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + agent_pool_name: agent_pool_name.into(), + agent_pool: agent_pool.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + agent_pool_name: impl Into, + update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + agent_pool_name: agent_pool_name.into(), + update_parameters: update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + agent_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get_queue_status( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + agent_pool_name: impl Into, + ) -> get_queue_status::Builder { + get_queue_status::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) agent_pool_name: String, + pub(crate) agent_pool: models::AgentPool, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.agent_pool).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) agent_pool_name: String, + pub(crate) update_parameters: models::AgentPoolUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_queue_status { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/agentPools/{}/listQueueStatus" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolQueueStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod runs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + filter: None, + top: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + run_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + run_id: run_id.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + run_id: impl Into, + run_update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + run_id: run_id.into(), + run_update_parameters: run_update_parameters.into(), + } + } + pub fn get_log_sas_url( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + run_id: impl Into, + ) -> get_log_sas_url::Builder { + get_log_sas_url::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + run_id: run_id.into(), + } + } + pub fn cancel( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + run_id: impl Into, + ) -> cancel::Builder { + cancel::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + run_id: run_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/runs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) run_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/runs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Run = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Run), + Created201(models::Run), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) run_id: String, + pub(crate) run_update_parameters: models::RunUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/runs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.run_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Run = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Run = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_log_sas_url { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) run_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/runs/{}/listLogSasUrl", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunGetLogResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod cancel { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) run_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/runs/{}/cancel", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod task_runs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_run_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_run_name: task_run_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_run_name: impl Into, + task_run: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_run_name: task_run_name.into(), + task_run: task_run.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_run_name: impl Into, + update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_run_name: task_run_name.into(), + update_parameters: update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_run_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_run_name: task_run_name.into(), + } + } + pub fn get_details( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_run_name: impl Into, + ) -> get_details::Builder { + get_details::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_run_name: task_run_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_run_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/taskRuns/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_run_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TaskRun = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::TaskRun), + Created201(models::TaskRun), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_run_name: String, + pub(crate) task_run: models::TaskRun, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/taskRuns/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_run_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.task_run).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TaskRun = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TaskRun = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::TaskRun), + Created201(models::TaskRun), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_run_name: String, + pub(crate) update_parameters: models::TaskRunUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/taskRuns/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_run_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TaskRun = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TaskRun = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_run_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/taskRuns/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_run_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_details { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_run_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/taskRuns/{}/listDetails", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_run_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TaskRun = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/taskRuns", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TaskRunListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tasks { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_name: task_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_name: impl Into, + task_create_parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_name: task_name.into(), + task_create_parameters: task_create_parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_name: impl Into, + task_update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_name: task_name.into(), + task_update_parameters: task_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_name: task_name.into(), + } + } + pub fn get_details( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + task_name: impl Into, + ) -> get_details::Builder { + get_details::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + task_name: task_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/tasks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TaskListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/tasks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Task = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Task), + Created201(models::Task), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_name: String, + pub(crate) task_create_parameters: models::Task, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/tasks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.task_create_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Task = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Task = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Task), + Created201(models::Task), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_name: String, + pub(crate) task_update_parameters: models::TaskUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/tasks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.task_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Task = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Task = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/tasks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_details { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) task_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/tasks/{}/listDetails", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.task_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Task = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/containerregistry/src/package_2021_09_only/mod.rs b/services/mgmt/containerregistry/src/package_2021_09_only/mod.rs new file mode 100644 index 0000000000..aef56ba7eb --- /dev/null +++ b/services/mgmt/containerregistry/src/package_2021_09_only/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-09-01"; diff --git a/services/mgmt/containerregistry/src/package_2021_09_only/models.rs b/services/mgmt/containerregistry/src/package_2021_09_only/models.rs new file mode 100644 index 0000000000..a0339cec32 --- /dev/null +++ b/services/mgmt/containerregistry/src/package_2021_09_only/models.rs @@ -0,0 +1,961 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Actor { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CallbackConfig { + #[serde(rename = "serviceUri")] + pub service_uri: String, + #[serde(rename = "customHeaders", default, skip_serializing_if = "Option::is_none")] + pub custom_headers: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionProperty { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] + pub key_vault_properties: Option, +} +pub mod encryption_property { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponseBody { + pub code: String, + pub message: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Event { + #[serde(flatten)] + pub event_info: EventInfo, + #[serde(rename = "eventRequestMessage", default, skip_serializing_if = "Option::is_none")] + pub event_request_message: Option, + #[serde(rename = "eventResponseMessage", default, skip_serializing_if = "Option::is_none")] + pub event_response_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventContent { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub request: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub actor: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventRequestMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[serde(rename = "requestUri", default, skip_serializing_if = "Option::is_none")] + pub request_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventResponseMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[serde(rename = "reasonPhrase", default, skip_serializing_if = "Option::is_none")] + pub reason_phrase: Option, + #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] + pub status_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportPolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod export_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpRule { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + pub value: String, +} +pub mod ip_rule { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Action { + Allow, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProperties { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod identity_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportImageParameters { + pub source: ImportSource, + #[serde(rename = "targetTags", default, skip_serializing_if = "Vec::is_empty")] + pub target_tags: Vec, + #[serde(rename = "untaggedTargetRepositories", default, skip_serializing_if = "Vec::is_empty")] + pub untagged_target_repositories: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, +} +pub mod import_image_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + NoForce, + Force, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportSource { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "registryUri", default, skip_serializing_if = "Option::is_none")] + pub registry_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + #[serde(rename = "sourceImage")] + pub source_image: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportSourceCredentials { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + pub password: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InnerErrorDescription { + pub code: String, + pub message: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultProperties { + #[serde(rename = "keyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub key_identifier: Option, + #[serde(rename = "versionedKeyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub versioned_key_identifier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(rename = "keyRotationEnabled", default, skip_serializing_if = "Option::is_none")] + pub key_rotation_enabled: Option, + #[serde(rename = "lastKeyRotationTimestamp", default, skip_serializing_if = "Option::is_none")] + pub last_key_rotation_timestamp: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkRuleSet { + #[serde(rename = "defaultAction")] + pub default_action: network_rule_set::DefaultAction, + #[serde(rename = "ipRules", default, skip_serializing_if = "Vec::is_empty")] + pub ip_rules: Vec, +} +pub mod network_rule_set { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DefaultAction { + Allow, + Deny, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDisplayDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationLogSpecificationDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationMetricSpecificationDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[serde(rename = "internalMetricName", default, skip_serializing_if = "Option::is_none")] + pub internal_metric_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationPropertiesDefinition { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationServiceSpecificationDefinition { + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PackageType { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Policies { + #[serde(rename = "quarantinePolicy", default, skip_serializing_if = "Option::is_none")] + pub quarantine_policy: Option, + #[serde(rename = "trustPolicy", default, skip_serializing_if = "Option::is_none")] + pub trust_policy: Option, + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, + #[serde(rename = "exportPolicy", default, skip_serializing_if = "Option::is_none")] + pub export_policy: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod private_endpoint_connection_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceProperties { + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Approved, + Pending, + Rejected, + Disconnected, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionsRequired { + None, + Recreate, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuarantinePolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod quarantine_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegenerateCredentialParameters { + pub name: regenerate_credential_parameters::Name, +} +pub mod regenerate_credential_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "password")] + Password, + #[serde(rename = "password2")] + Password2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Registry { + #[serde(flatten)] + pub resource: Resource, + pub sku: Sku, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryListCredentialsResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub passwords: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryNameCheckRequest { + pub name: String, + #[serde(rename = "type")] + pub type_: registry_name_check_request::Type, +} +pub mod registry_name_check_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "Microsoft.ContainerRegistry/registries")] + MicrosoftContainerRegistryRegistries, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryNameStatus { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryPassword { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +pub mod registry_password { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "password")] + Password, + #[serde(rename = "password2")] + Password2, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryProperties { + #[serde(rename = "loginServer", default, skip_serializing_if = "Option::is_none")] + pub login_server: Option, + #[serde(rename = "creationDate", default, skip_serializing_if = "Option::is_none")] + pub creation_date: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "adminUserEnabled", default, skip_serializing_if = "Option::is_none")] + pub admin_user_enabled: Option, + #[serde(rename = "networkRuleSet", default, skip_serializing_if = "Option::is_none")] + pub network_rule_set: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub policies: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "dataEndpointEnabled", default, skip_serializing_if = "Option::is_none")] + pub data_endpoint_enabled: Option, + #[serde(rename = "dataEndpointHostNames", default, skip_serializing_if = "Vec::is_empty")] + pub data_endpoint_host_names: Vec, + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "networkRuleBypassOptions", default, skip_serializing_if = "Option::is_none")] + pub network_rule_bypass_options: Option, + #[serde(rename = "zoneRedundancy", default, skip_serializing_if = "Option::is_none")] + pub zone_redundancy: Option, +} +pub mod registry_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkRuleBypassOptions { + AzureServices, + None, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ZoneRedundancy { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryPropertiesUpdateParameters { + #[serde(rename = "adminUserEnabled", default, skip_serializing_if = "Option::is_none")] + pub admin_user_enabled: Option, + #[serde(rename = "networkRuleSet", default, skip_serializing_if = "Option::is_none")] + pub network_rule_set: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub policies: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "dataEndpointEnabled", default, skip_serializing_if = "Option::is_none")] + pub data_endpoint_enabled: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "networkRuleBypassOptions", default, skip_serializing_if = "Option::is_none")] + pub network_rule_bypass_options: Option, +} +pub mod registry_properties_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkRuleBypassOptions { + AzureServices, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryUsage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, +} +pub mod registry_usage { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegistryUsageListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Replication { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "regionEndpointEnabled", default, skip_serializing_if = "Option::is_none")] + pub region_endpoint_enabled: Option, + #[serde(rename = "zoneRedundancy", default, skip_serializing_if = "Option::is_none")] + pub zone_redundancy: Option, +} +pub mod replication_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ZoneRedundancy { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationUpdateParametersProperties { + #[serde(rename = "regionEndpointEnabled", default, skip_serializing_if = "Option::is_none")] + pub region_endpoint_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Request { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub addr: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub useragent: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionPolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub days: Option, + #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod retention_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + pub name: sku::Name, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Classic, + Basic, + Standard, + Premium, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Classic, + Basic, + Standard, + Premium, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Source { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub addr: Option, + #[serde(rename = "instanceID", default, skip_serializing_if = "Option::is_none")] + pub instance_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Status { + #[serde(rename = "displayStatus", default, skip_serializing_if = "Option::is_none")] + pub display_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccountProperties { + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Target { + #[serde(rename = "mediaType", default, skip_serializing_if = "Option::is_none")] + pub media_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub digest: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub length: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrustPolicy { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod trust_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Notary, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserIdentityProperties { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Webhook { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookCreateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + pub actions: Vec, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +pub mod webhook_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookPropertiesCreateParameters { + #[serde(rename = "serviceUri")] + pub service_uri: String, + #[serde(rename = "customHeaders", default, skip_serializing_if = "Option::is_none")] + pub custom_headers: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + pub actions: Vec, +} +pub mod webhook_properties_create_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookPropertiesUpdateParameters { + #[serde(rename = "serviceUri", default, skip_serializing_if = "Option::is_none")] + pub service_uri: Option, + #[serde(rename = "customHeaders", default, skip_serializing_if = "Option::is_none")] + pub custom_headers: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, +} +pub mod webhook_properties_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} diff --git a/services/mgmt/containerregistry/src/package_2021_09_only/operations.rs b/services/mgmt/containerregistry/src/package_2021_09_only/operations.rs new file mode 100644 index 0000000000..f04457c7b7 --- /dev/null +++ b/services/mgmt/containerregistry/src/package_2021_09_only/operations.rs @@ -0,0 +1,2955 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn registries(&self) -> registries::Client { + registries::Client(self.clone()) + } + pub fn replications(&self) -> replications::Client { + replications::Client(self.clone()) + } + pub fn webhooks(&self) -> webhooks::Client { + webhooks::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Registries_ImportImage(#[from] registries::import_image::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Registries_CheckNameAvailability(#[from] registries::check_name_availability::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_CreateOrUpdate(#[from] private_endpoint_connections::create_or_update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + Registries_List(#[from] registries::list::Error), + #[error(transparent)] + Registries_ListByResourceGroup(#[from] registries::list_by_resource_group::Error), + #[error(transparent)] + Registries_Get(#[from] registries::get::Error), + #[error(transparent)] + Registries_Create(#[from] registries::create::Error), + #[error(transparent)] + Registries_Update(#[from] registries::update::Error), + #[error(transparent)] + Registries_Delete(#[from] registries::delete::Error), + #[error(transparent)] + Registries_ListUsages(#[from] registries::list_usages::Error), + #[error(transparent)] + Registries_ListPrivateLinkResources(#[from] registries::list_private_link_resources::Error), + #[error(transparent)] + Registries_GetPrivateLinkResource(#[from] registries::get_private_link_resource::Error), + #[error(transparent)] + Registries_ListCredentials(#[from] registries::list_credentials::Error), + #[error(transparent)] + Registries_RegenerateCredential(#[from] registries::regenerate_credential::Error), + #[error(transparent)] + Replications_List(#[from] replications::list::Error), + #[error(transparent)] + Replications_Get(#[from] replications::get::Error), + #[error(transparent)] + Replications_Create(#[from] replications::create::Error), + #[error(transparent)] + Replications_Update(#[from] replications::update::Error), + #[error(transparent)] + Replications_Delete(#[from] replications::delete::Error), + #[error(transparent)] + Webhooks_List(#[from] webhooks::list::Error), + #[error(transparent)] + Webhooks_Get(#[from] webhooks::get::Error), + #[error(transparent)] + Webhooks_Create(#[from] webhooks::create::Error), + #[error(transparent)] + Webhooks_Update(#[from] webhooks::update::Error), + #[error(transparent)] + Webhooks_Delete(#[from] webhooks::delete::Error), + #[error(transparent)] + Webhooks_Ping(#[from] webhooks::ping::Error), + #[error(transparent)] + Webhooks_ListEvents(#[from] webhooks::list_events::Error), + #[error(transparent)] + Webhooks_GetCallbackConfig(#[from] webhooks::get_callback_config::Error), +} +pub mod registries { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn import_image( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + parameters: impl Into, + ) -> import_image::Builder { + import_image::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + parameters: parameters.into(), + } + } + pub fn check_name_availability( + &self, + subscription_id: impl Into, + registry_name_check_request: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + registry_name_check_request: registry_name_check_request.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + registry: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + registry: registry.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + registry_update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + registry_update_parameters: registry_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn list_usages( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list_usages::Builder { + list_usages::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn list_private_link_resources( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list_private_link_resources::Builder { + list_private_link_resources::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get_private_link_resource( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + group_name: impl Into, + ) -> get_private_link_resource::Builder { + get_private_link_resource::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + group_name: group_name.into(), + } + } + pub fn list_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list_credentials::Builder { + list_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn regenerate_credential( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + regenerate_credential_parameters: impl Into, + ) -> regenerate_credential::Builder { + regenerate_credential::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + regenerate_credential_parameters: regenerate_credential_parameters.into(), + } + } + } + pub mod import_image { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) parameters: models::ImportImageParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/importImage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) registry_name_check_request: models::RegistryNameCheckRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerRegistry/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.registry_name_check_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryNameStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerRegistry/registries", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Registry), + Created201(models::Registry), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) registry: models::Registry, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.registry).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Registry), + Created201(models::Registry), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) registry_update_parameters: models::RegistryUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.registry_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Registry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_usages { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/listUsages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryUsageListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_private_link_resources { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_private_link_resource { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/listCredentials", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryListCredentialsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod regenerate_credential { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) regenerate_credential_parameters: models::RegenerateCredentialParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/regenerateCredential", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.regenerate_credential_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegistryListCredentialsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerRegistry/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + private_endpoint_connection_name: impl Into, + private_endpoint_connection: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + private_endpoint_connection: private_endpoint_connection.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnection), + Created201(models::PrivateEndpointConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) private_endpoint_connection: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.private_endpoint_connection).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replications { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + replication_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + replication_name: replication_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + replication_name: impl Into, + replication: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + replication_name: replication_name.into(), + replication: replication.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + replication_name: impl Into, + replication_update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + replication_name: replication_name.into(), + replication_update_parameters: replication_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + replication_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + replication_name: replication_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) replication_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.replication_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Replication), + Created201(models::Replication), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) replication_name: String, + pub(crate) replication: models::Replication, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.replication_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.replication).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Replication), + Created201(models::Replication), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) replication_name: String, + pub(crate) replication_update_parameters: models::ReplicationUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.replication_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.replication_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Replication = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) replication_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/replications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.replication_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod webhooks { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + webhook_create_parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + webhook_create_parameters: webhook_create_parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + webhook_update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + webhook_update_parameters: webhook_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + pub fn ping( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> ping::Builder { + ping::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + pub fn list_events( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> list_events::Builder { + list_events::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + pub fn get_callback_config( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + registry_name: impl Into, + webhook_name: impl Into, + ) -> get_callback_config::Builder { + get_callback_config::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + registry_name: registry_name.into(), + webhook_name: webhook_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WebhookListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Webhook), + Created201(models::Webhook), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + pub(crate) webhook_create_parameters: models::WebhookCreateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.webhook_create_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Webhook), + Created201(models::Webhook), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + pub(crate) webhook_update_parameters: models::WebhookUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.webhook_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Webhook = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod ping { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}/ping", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EventInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_events { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}/listEvents", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.registry_name, + &self.webhook_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EventListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_callback_config { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) registry_name: String, + pub(crate) webhook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerRegistry/registries/{}/webhooks/{}/getCallbackConfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . registry_name , & self . webhook_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CallbackConfig = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/containerservice/Cargo.toml b/services/mgmt/containerservice/Cargo.toml index 410223bef8..8f06d30397 100644 --- a/services/mgmt/containerservice/Cargo.toml +++ b/services/mgmt/containerservice/Cargo.toml @@ -19,10 +19,12 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2021-09", "enable_reqwest"] +default = ["package-2021-10", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-preview-2021-11" = [] +"package-2021-10" = [] "package-2021-09" = [] "package-2021-08" = [] "package-2021-07" = [] @@ -52,6 +54,8 @@ no-default-version = [] "package-2017-09" = [] "package-2017-08" = [] "package-2017-07" = [] +"package-2021-11-01-preview-only" = [] +"package-2021-10-01-only" = [] "package-2021-09-01-only" = [] "package-2021-08-01-only" = [] "package-2021-07-01-only" = [] @@ -85,3 +89,4 @@ no-default-version = [] "package-2017-01-only" = [] "package-2016-09-only" = [] "package-2016-03-only" = [] +"profile-hybrid-2020-09-01" = [] diff --git a/services/mgmt/containerservice/src/lib.rs b/services/mgmt/containerservice/src/lib.rs index 49cd74ab00..cd92005d45 100644 --- a/services/mgmt/containerservice/src/lib.rs +++ b/services/mgmt/containerservice/src/lib.rs @@ -3,6 +3,14 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-preview-2021-11")] +pub mod package_preview_2021_11; +#[cfg(all(feature = "package-preview-2021-11", not(feature = "no-default-version")))] +pub use package_preview_2021_11::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-10")] +pub mod package_2021_10; +#[cfg(all(feature = "package-2021-10", not(feature = "no-default-version")))] +pub use package_2021_10::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-09")] pub mod package_2021_09; #[cfg(all(feature = "package-2021-09", not(feature = "no-default-version")))] @@ -119,6 +127,14 @@ pub use package_2017_08::{models, operations, operations::Client, operations::Cl pub mod package_2017_07; #[cfg(all(feature = "package-2017-07", not(feature = "no-default-version")))] pub use package_2017_07::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-11-01-preview-only")] +pub mod package_2021_11_01_preview_only; +#[cfg(all(feature = "package-2021-11-01-preview-only", not(feature = "no-default-version")))] +pub use package_2021_11_01_preview_only::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-10-01-only")] +pub mod package_2021_10_01_only; +#[cfg(all(feature = "package-2021-10-01-only", not(feature = "no-default-version")))] +pub use package_2021_10_01_only::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-09-01-only")] pub mod package_2021_09_01_only; #[cfg(all(feature = "package-2021-09-01-only", not(feature = "no-default-version")))] @@ -251,3 +267,7 @@ pub use package_2016_09_only::{models, operations, operations::Client, operation pub mod package_2016_03_only; #[cfg(all(feature = "package-2016-03-only", not(feature = "no-default-version")))] pub use package_2016_03_only::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "profile-hybrid-2020-09-01")] +pub mod profile_hybrid_2020_09_01; +#[cfg(all(feature = "profile-hybrid-2020-09-01", not(feature = "no-default-version")))] +pub use profile_hybrid_2020_09_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/containerservice/src/package_2021_10/mod.rs b/services/mgmt/containerservice/src/package_2021_10/mod.rs new file mode 100644 index 0000000000..cdd7552b47 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_10/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-10-01"; diff --git a/services/mgmt/containerservice/src/package_2021_10/models.rs b/services/mgmt/containerservice/src/package_2021_10/models.rs new file mode 100644 index 0000000000..76670bc78c --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_10/models.rs @@ -0,0 +1,1645 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccessProfile { + #[serde(rename = "kubeConfig", default, skip_serializing_if = "Option::is_none")] + pub kube_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolAvailableVersionsProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersionsProperties { + #[serde(rename = "agentPoolVersions", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_versions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolMode { + System, + User, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolType { + VirtualMachineScaleSets, + AvailabilitySet, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfileProperties { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, + #[serde(rename = "latestNodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_node_image_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeSettings { + #[serde(rename = "maxSurge", default, skip_serializing_if = "Option::is_none")] + pub max_surge: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommandResultProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "exitCode", default, skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + #[serde(rename = "startedAt", default, skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[serde(rename = "finishedAt", default, skip_serializing_if = "Option::is_none")] + pub finished_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub logs: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceDiagnosticsProfile { + #[serde(rename = "vmDiagnostics")] + pub vm_diagnostics: ContainerServiceVmDiagnostics, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceLinuxProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + pub ssh: ContainerServiceSshConfiguration, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceMasterProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "dnsPrefix")] + pub dns_prefix: String, + #[serde(rename = "vmSize")] + pub vm_size: ContainerServiceVmSize, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "firstConsecutiveStaticIP", default, skip_serializing_if = "Option::is_none")] + pub first_consecutive_static_ip: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, +} +pub mod container_service_master_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Count {} +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceNetworkProfile { + #[serde(rename = "networkPlugin", default, skip_serializing_if = "Option::is_none")] + pub network_plugin: Option, + #[serde(rename = "networkPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_policy: Option, + #[serde(rename = "networkMode", default, skip_serializing_if = "Option::is_none")] + pub network_mode: Option, + #[serde(rename = "podCidr", default, skip_serializing_if = "Option::is_none")] + pub pod_cidr: Option, + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, + #[serde(rename = "dnsServiceIP", default, skip_serializing_if = "Option::is_none")] + pub dns_service_ip: Option, + #[serde(rename = "dockerBridgeCidr", default, skip_serializing_if = "Option::is_none")] + pub docker_bridge_cidr: Option, + #[serde(rename = "outboundType", default, skip_serializing_if = "Option::is_none")] + pub outbound_type: Option, + #[serde(rename = "loadBalancerSku", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_sku: Option, + #[serde(rename = "loadBalancerProfile", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_profile: Option, + #[serde(rename = "natGatewayProfile", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway_profile: Option, + #[serde(rename = "podCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub pod_cidrs: Vec, + #[serde(rename = "serviceCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub service_cidrs: Vec, + #[serde(rename = "ipFamilies", default, skip_serializing_if = "Vec::is_empty")] + pub ip_families: Vec, +} +pub mod container_service_network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPlugin { + #[serde(rename = "azure")] + Azure, + #[serde(rename = "kubenet")] + Kubenet, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPolicy { + #[serde(rename = "calico")] + Calico, + #[serde(rename = "azure")] + Azure, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkMode { + #[serde(rename = "transparent")] + Transparent, + #[serde(rename = "bridge")] + Bridge, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OutboundType { + #[serde(rename = "loadBalancer")] + LoadBalancer, + #[serde(rename = "userDefinedRouting")] + UserDefinedRouting, + #[serde(rename = "managedNATGateway")] + ManagedNatGateway, + #[serde(rename = "userAssignedNATGateway")] + UserAssignedNatGateway, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoadBalancerSku { + #[serde(rename = "standard")] + Standard, + #[serde(rename = "basic")] + Basic, + } +} +pub type ContainerServiceOsDisk = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshConfiguration { + #[serde(rename = "publicKeys")] + pub public_keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshPublicKey { + #[serde(rename = "keyData")] + pub key_data: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceStorageProfile { + StorageAccount, + ManagedDisks, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceVmDiagnostics { + pub enabled: bool, + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceVmSize { + #[serde(rename = "Standard_A1")] + StandardA1, + #[serde(rename = "Standard_A10")] + StandardA10, + #[serde(rename = "Standard_A11")] + StandardA11, + #[serde(rename = "Standard_A1_v2")] + StandardA1V2, + #[serde(rename = "Standard_A2")] + StandardA2, + #[serde(rename = "Standard_A2_v2")] + StandardA2V2, + #[serde(rename = "Standard_A2m_v2")] + StandardA2mV2, + #[serde(rename = "Standard_A3")] + StandardA3, + #[serde(rename = "Standard_A4")] + StandardA4, + #[serde(rename = "Standard_A4_v2")] + StandardA4V2, + #[serde(rename = "Standard_A4m_v2")] + StandardA4mV2, + #[serde(rename = "Standard_A5")] + StandardA5, + #[serde(rename = "Standard_A6")] + StandardA6, + #[serde(rename = "Standard_A7")] + StandardA7, + #[serde(rename = "Standard_A8")] + StandardA8, + #[serde(rename = "Standard_A8_v2")] + StandardA8V2, + #[serde(rename = "Standard_A8m_v2")] + StandardA8mV2, + #[serde(rename = "Standard_A9")] + StandardA9, + #[serde(rename = "Standard_B2ms")] + StandardB2ms, + #[serde(rename = "Standard_B2s")] + StandardB2s, + #[serde(rename = "Standard_B4ms")] + StandardB4ms, + #[serde(rename = "Standard_B8ms")] + StandardB8ms, + #[serde(rename = "Standard_D1")] + StandardD1, + #[serde(rename = "Standard_D11")] + StandardD11, + #[serde(rename = "Standard_D11_v2")] + StandardD11V2, + #[serde(rename = "Standard_D11_v2_Promo")] + StandardD11V2Promo, + #[serde(rename = "Standard_D12")] + StandardD12, + #[serde(rename = "Standard_D12_v2")] + StandardD12V2, + #[serde(rename = "Standard_D12_v2_Promo")] + StandardD12V2Promo, + #[serde(rename = "Standard_D13")] + StandardD13, + #[serde(rename = "Standard_D13_v2")] + StandardD13V2, + #[serde(rename = "Standard_D13_v2_Promo")] + StandardD13V2Promo, + #[serde(rename = "Standard_D14")] + StandardD14, + #[serde(rename = "Standard_D14_v2")] + StandardD14V2, + #[serde(rename = "Standard_D14_v2_Promo")] + StandardD14V2Promo, + #[serde(rename = "Standard_D15_v2")] + StandardD15V2, + #[serde(rename = "Standard_D16_v3")] + StandardD16V3, + #[serde(rename = "Standard_D16s_v3")] + StandardD16sV3, + #[serde(rename = "Standard_D1_v2")] + StandardD1V2, + #[serde(rename = "Standard_D2")] + StandardD2, + #[serde(rename = "Standard_D2_v2")] + StandardD2V2, + #[serde(rename = "Standard_D2_v2_Promo")] + StandardD2V2Promo, + #[serde(rename = "Standard_D2_v3")] + StandardD2V3, + #[serde(rename = "Standard_D2s_v3")] + StandardD2sV3, + #[serde(rename = "Standard_D3")] + StandardD3, + #[serde(rename = "Standard_D32_v3")] + StandardD32V3, + #[serde(rename = "Standard_D32s_v3")] + StandardD32sV3, + #[serde(rename = "Standard_D3_v2")] + StandardD3V2, + #[serde(rename = "Standard_D3_v2_Promo")] + StandardD3V2Promo, + #[serde(rename = "Standard_D4")] + StandardD4, + #[serde(rename = "Standard_D4_v2")] + StandardD4V2, + #[serde(rename = "Standard_D4_v2_Promo")] + StandardD4V2Promo, + #[serde(rename = "Standard_D4_v3")] + StandardD4V3, + #[serde(rename = "Standard_D4s_v3")] + StandardD4sV3, + #[serde(rename = "Standard_D5_v2")] + StandardD5V2, + #[serde(rename = "Standard_D5_v2_Promo")] + StandardD5V2Promo, + #[serde(rename = "Standard_D64_v3")] + StandardD64V3, + #[serde(rename = "Standard_D64s_v3")] + StandardD64sV3, + #[serde(rename = "Standard_D8_v3")] + StandardD8V3, + #[serde(rename = "Standard_D8s_v3")] + StandardD8sV3, + #[serde(rename = "Standard_DS1")] + StandardDs1, + #[serde(rename = "Standard_DS11")] + StandardDs11, + #[serde(rename = "Standard_DS11_v2")] + StandardDs11V2, + #[serde(rename = "Standard_DS11_v2_Promo")] + StandardDs11V2Promo, + #[serde(rename = "Standard_DS12")] + StandardDs12, + #[serde(rename = "Standard_DS12_v2")] + StandardDs12V2, + #[serde(rename = "Standard_DS12_v2_Promo")] + StandardDs12V2Promo, + #[serde(rename = "Standard_DS13")] + StandardDs13, + #[serde(rename = "Standard_DS13-2_v2")] + StandardDs132V2, + #[serde(rename = "Standard_DS13-4_v2")] + StandardDs134V2, + #[serde(rename = "Standard_DS13_v2")] + StandardDs13V2, + #[serde(rename = "Standard_DS13_v2_Promo")] + StandardDs13V2Promo, + #[serde(rename = "Standard_DS14")] + StandardDs14, + #[serde(rename = "Standard_DS14-4_v2")] + StandardDs144V2, + #[serde(rename = "Standard_DS14-8_v2")] + StandardDs148V2, + #[serde(rename = "Standard_DS14_v2")] + StandardDs14V2, + #[serde(rename = "Standard_DS14_v2_Promo")] + StandardDs14V2Promo, + #[serde(rename = "Standard_DS15_v2")] + StandardDs15V2, + #[serde(rename = "Standard_DS1_v2")] + StandardDs1V2, + #[serde(rename = "Standard_DS2")] + StandardDs2, + #[serde(rename = "Standard_DS2_v2")] + StandardDs2V2, + #[serde(rename = "Standard_DS2_v2_Promo")] + StandardDs2V2Promo, + #[serde(rename = "Standard_DS3")] + StandardDs3, + #[serde(rename = "Standard_DS3_v2")] + StandardDs3V2, + #[serde(rename = "Standard_DS3_v2_Promo")] + StandardDs3V2Promo, + #[serde(rename = "Standard_DS4")] + StandardDs4, + #[serde(rename = "Standard_DS4_v2")] + StandardDs4V2, + #[serde(rename = "Standard_DS4_v2_Promo")] + StandardDs4V2Promo, + #[serde(rename = "Standard_DS5_v2")] + StandardDs5V2, + #[serde(rename = "Standard_DS5_v2_Promo")] + StandardDs5V2Promo, + #[serde(rename = "Standard_E16_v3")] + StandardE16V3, + #[serde(rename = "Standard_E16s_v3")] + StandardE16sV3, + #[serde(rename = "Standard_E2_v3")] + StandardE2V3, + #[serde(rename = "Standard_E2s_v3")] + StandardE2sV3, + #[serde(rename = "Standard_E32-16s_v3")] + StandardE3216sV3, + #[serde(rename = "Standard_E32-8s_v3")] + StandardE328sV3, + #[serde(rename = "Standard_E32_v3")] + StandardE32V3, + #[serde(rename = "Standard_E32s_v3")] + StandardE32sV3, + #[serde(rename = "Standard_E4_v3")] + StandardE4V3, + #[serde(rename = "Standard_E4s_v3")] + StandardE4sV3, + #[serde(rename = "Standard_E64-16s_v3")] + StandardE6416sV3, + #[serde(rename = "Standard_E64-32s_v3")] + StandardE6432sV3, + #[serde(rename = "Standard_E64_v3")] + StandardE64V3, + #[serde(rename = "Standard_E64s_v3")] + StandardE64sV3, + #[serde(rename = "Standard_E8_v3")] + StandardE8V3, + #[serde(rename = "Standard_E8s_v3")] + StandardE8sV3, + #[serde(rename = "Standard_F1")] + StandardF1, + #[serde(rename = "Standard_F16")] + StandardF16, + #[serde(rename = "Standard_F16s")] + StandardF16s, + #[serde(rename = "Standard_F16s_v2")] + StandardF16sV2, + #[serde(rename = "Standard_F1s")] + StandardF1s, + #[serde(rename = "Standard_F2")] + StandardF2, + #[serde(rename = "Standard_F2s")] + StandardF2s, + #[serde(rename = "Standard_F2s_v2")] + StandardF2sV2, + #[serde(rename = "Standard_F32s_v2")] + StandardF32sV2, + #[serde(rename = "Standard_F4")] + StandardF4, + #[serde(rename = "Standard_F4s")] + StandardF4s, + #[serde(rename = "Standard_F4s_v2")] + StandardF4sV2, + #[serde(rename = "Standard_F64s_v2")] + StandardF64sV2, + #[serde(rename = "Standard_F72s_v2")] + StandardF72sV2, + #[serde(rename = "Standard_F8")] + StandardF8, + #[serde(rename = "Standard_F8s")] + StandardF8s, + #[serde(rename = "Standard_F8s_v2")] + StandardF8sV2, + #[serde(rename = "Standard_G1")] + StandardG1, + #[serde(rename = "Standard_G2")] + StandardG2, + #[serde(rename = "Standard_G3")] + StandardG3, + #[serde(rename = "Standard_G4")] + StandardG4, + #[serde(rename = "Standard_G5")] + StandardG5, + #[serde(rename = "Standard_GS1")] + StandardGs1, + #[serde(rename = "Standard_GS2")] + StandardGs2, + #[serde(rename = "Standard_GS3")] + StandardGs3, + #[serde(rename = "Standard_GS4")] + StandardGs4, + #[serde(rename = "Standard_GS4-4")] + StandardGs44, + #[serde(rename = "Standard_GS4-8")] + StandardGs48, + #[serde(rename = "Standard_GS5")] + StandardGs5, + #[serde(rename = "Standard_GS5-16")] + StandardGs516, + #[serde(rename = "Standard_GS5-8")] + StandardGs58, + #[serde(rename = "Standard_H16")] + StandardH16, + #[serde(rename = "Standard_H16m")] + StandardH16m, + #[serde(rename = "Standard_H16mr")] + StandardH16mr, + #[serde(rename = "Standard_H16r")] + StandardH16r, + #[serde(rename = "Standard_H8")] + StandardH8, + #[serde(rename = "Standard_H8m")] + StandardH8m, + #[serde(rename = "Standard_L16s")] + StandardL16s, + #[serde(rename = "Standard_L32s")] + StandardL32s, + #[serde(rename = "Standard_L4s")] + StandardL4s, + #[serde(rename = "Standard_L8s")] + StandardL8s, + #[serde(rename = "Standard_M128-32ms")] + StandardM12832ms, + #[serde(rename = "Standard_M128-64ms")] + StandardM12864ms, + #[serde(rename = "Standard_M128ms")] + StandardM128ms, + #[serde(rename = "Standard_M128s")] + StandardM128s, + #[serde(rename = "Standard_M64-16ms")] + StandardM6416ms, + #[serde(rename = "Standard_M64-32ms")] + StandardM6432ms, + #[serde(rename = "Standard_M64ms")] + StandardM64ms, + #[serde(rename = "Standard_M64s")] + StandardM64s, + #[serde(rename = "Standard_NC12")] + StandardNc12, + #[serde(rename = "Standard_NC12s_v2")] + StandardNc12sV2, + #[serde(rename = "Standard_NC12s_v3")] + StandardNc12sV3, + #[serde(rename = "Standard_NC24")] + StandardNc24, + #[serde(rename = "Standard_NC24r")] + StandardNc24r, + #[serde(rename = "Standard_NC24rs_v2")] + StandardNc24rsV2, + #[serde(rename = "Standard_NC24rs_v3")] + StandardNc24rsV3, + #[serde(rename = "Standard_NC24s_v2")] + StandardNc24sV2, + #[serde(rename = "Standard_NC24s_v3")] + StandardNc24sV3, + #[serde(rename = "Standard_NC6")] + StandardNc6, + #[serde(rename = "Standard_NC6s_v2")] + StandardNc6sV2, + #[serde(rename = "Standard_NC6s_v3")] + StandardNc6sV3, + #[serde(rename = "Standard_ND12s")] + StandardNd12s, + #[serde(rename = "Standard_ND24rs")] + StandardNd24rs, + #[serde(rename = "Standard_ND24s")] + StandardNd24s, + #[serde(rename = "Standard_ND6s")] + StandardNd6s, + #[serde(rename = "Standard_NV12")] + StandardNv12, + #[serde(rename = "Standard_NV24")] + StandardNv24, + #[serde(rename = "Standard_NV6")] + StandardNv6, +} +pub type ContainerServiceVnetSubnetId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreationData { + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResults { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub kubeconfigs: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointDependency { + #[serde(rename = "domainName", default, skip_serializing_if = "Option::is_none")] + pub domain_name: Option, + #[serde(rename = "endpointDetails", default, skip_serializing_if = "Vec::is_empty")] + pub endpoint_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointDetail { + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExtendedLocationType { + EdgeZone, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum GpuInstanceProfile { + #[serde(rename = "MIG1g")] + Mig1g, + #[serde(rename = "MIG2g")] + Mig2g, + #[serde(rename = "MIG3g")] + Mig3g, + #[serde(rename = "MIG4g")] + Mig4g, + #[serde(rename = "MIG7g")] + Mig7g, +} +pub type HourInDay = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubeletConfig { + #[serde(rename = "cpuManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub cpu_manager_policy: Option, + #[serde(rename = "cpuCfsQuota", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota: Option, + #[serde(rename = "cpuCfsQuotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota_period: Option, + #[serde(rename = "imageGcHighThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_high_threshold: Option, + #[serde(rename = "imageGcLowThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_low_threshold: Option, + #[serde(rename = "topologyManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub topology_manager_policy: Option, + #[serde(rename = "allowedUnsafeSysctls", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_unsafe_sysctls: Vec, + #[serde(rename = "failSwapOn", default, skip_serializing_if = "Option::is_none")] + pub fail_swap_on: Option, + #[serde(rename = "containerLogMaxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_size_mb: Option, + #[serde(rename = "containerLogMaxFiles", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_files: Option, + #[serde(rename = "podMaxPids", default, skip_serializing_if = "Option::is_none")] + pub pod_max_pids: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KubeletDiskType { + #[serde(rename = "OS")] + Os, + Temporary, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinuxOsConfig { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sysctls: Option, + #[serde(rename = "transparentHugePageEnabled", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_enabled: Option, + #[serde(rename = "transparentHugePageDefrag", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_defrag: Option, + #[serde(rename = "swapFileSizeMB", default, skip_serializing_if = "Option::is_none")] + pub swap_file_size_mb: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfigurationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfigurationProperties { + #[serde(rename = "timeInWeek", default, skip_serializing_if = "Vec::is_empty")] + pub time_in_week: Vec, + #[serde(rename = "notAllowedTime", default, skip_serializing_if = "Vec::is_empty")] + pub not_allowed_time: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCluster { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAadProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub managed: Option, + #[serde(rename = "enableAzureRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_azure_rbac: Option, + #[serde(rename = "adminGroupObjectIDs", default, skip_serializing_if = "Vec::is_empty")] + pub admin_group_object_i_ds: Vec, + #[serde(rename = "clientAppID", default, skip_serializing_if = "Option::is_none")] + pub client_app_id: Option, + #[serde(rename = "serverAppID", default, skip_serializing_if = "Option::is_none")] + pub server_app_id: Option, + #[serde(rename = "serverAppSecret", default, skip_serializing_if = "Option::is_none")] + pub server_app_secret: Option, + #[serde(rename = "tenantID", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterApiServerAccessProfile { + #[serde(rename = "authorizedIPRanges", default, skip_serializing_if = "Vec::is_empty")] + pub authorized_ip_ranges: Vec, + #[serde(rename = "enablePrivateCluster", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster: Option, + #[serde(rename = "privateDNSZone", default, skip_serializing_if = "Option::is_none")] + pub private_dns_zone: Option, + #[serde(rename = "enablePrivateClusterPublicFQDN", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster_public_fqdn: Option, + #[serde(rename = "disableRunCommand", default, skip_serializing_if = "Option::is_none")] + pub disable_run_command: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAccessProfile { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAddonProfile { + pub enabled: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub config: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfile { + #[serde(flatten)] + pub managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties, + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfileProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "osDiskType", default, skip_serializing_if = "Option::is_none")] + pub os_disk_type: Option, + #[serde(rename = "kubeletDiskType", default, skip_serializing_if = "Option::is_none")] + pub kubelet_disk_type: Option, + #[serde(rename = "workloadRuntime", default, skip_serializing_if = "Option::is_none")] + pub workload_runtime: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "podSubnetID", default, skip_serializing_if = "Option::is_none")] + pub pod_subnet_id: Option, + #[serde(rename = "maxPods", default, skip_serializing_if = "Option::is_none")] + pub max_pods: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osSKU", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[serde(rename = "maxCount", default, skip_serializing_if = "Option::is_none")] + pub max_count: Option, + #[serde(rename = "minCount", default, skip_serializing_if = "Option::is_none")] + pub min_count: Option, + #[serde(rename = "enableAutoScaling", default, skip_serializing_if = "Option::is_none")] + pub enable_auto_scaling: Option, + #[serde(rename = "scaleDownMode", default, skip_serializing_if = "Option::is_none")] + pub scale_down_mode: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "orchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "upgradeSettings", default, skip_serializing_if = "Option::is_none")] + pub upgrade_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "availabilityZones", default, skip_serializing_if = "Vec::is_empty")] + pub availability_zones: Vec, + #[serde(rename = "enableNodePublicIP", default, skip_serializing_if = "Option::is_none")] + pub enable_node_public_ip: Option, + #[serde(rename = "nodePublicIPPrefixID", default, skip_serializing_if = "Option::is_none")] + pub node_public_ip_prefix_id: Option, + #[serde(rename = "scaleSetPriority", default, skip_serializing_if = "Option::is_none")] + pub scale_set_priority: Option, + #[serde(rename = "scaleSetEvictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_set_eviction_policy: Option, + #[serde(rename = "spotMaxPrice", default, skip_serializing_if = "Option::is_none")] + pub spot_max_price: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "nodeLabels", default, skip_serializing_if = "Option::is_none")] + pub node_labels: Option, + #[serde(rename = "nodeTaints", default, skip_serializing_if = "Vec::is_empty")] + pub node_taints: Vec, + #[serde(rename = "proximityPlacementGroupID", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group_id: Option, + #[serde(rename = "kubeletConfig", default, skip_serializing_if = "Option::is_none")] + pub kubelet_config: Option, + #[serde(rename = "linuxOSConfig", default, skip_serializing_if = "Option::is_none")] + pub linux_os_config: Option, + #[serde(rename = "enableEncryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub enable_encryption_at_host: Option, + #[serde(rename = "enableUltraSSD", default, skip_serializing_if = "Option::is_none")] + pub enable_ultra_ssd: Option, + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, + #[serde(rename = "gpuInstanceProfile", default, skip_serializing_if = "Option::is_none")] + pub gpu_instance_profile: Option, + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAutoUpgradeProfile { + #[serde(rename = "upgradeChannel", default, skip_serializing_if = "Option::is_none")] + pub upgrade_channel: Option, +} +pub mod managed_cluster_auto_upgrade_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpgradeChannel { + #[serde(rename = "rapid")] + Rapid, + #[serde(rename = "stable")] + Stable, + #[serde(rename = "patch")] + Patch, + #[serde(rename = "node-image")] + NodeImage, + #[serde(rename = "none")] + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterHttpProxyConfig { + #[serde(rename = "httpProxy", default, skip_serializing_if = "Option::is_none")] + pub http_proxy: Option, + #[serde(rename = "httpsProxy", default, skip_serializing_if = "Option::is_none")] + pub https_proxy: Option, + #[serde(rename = "noProxy", default, skip_serializing_if = "Vec::is_empty")] + pub no_proxy: Vec, + #[serde(rename = "trustedCa", default, skip_serializing_if = "Option::is_none")] + pub trusted_ca: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod managed_cluster_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterLoadBalancerProfile { + #[serde(rename = "managedOutboundIPs", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_i_ps: Option, + #[serde(rename = "outboundIPPrefixes", default, skip_serializing_if = "Option::is_none")] + pub outbound_ip_prefixes: Option, + #[serde(rename = "outboundIPs", default, skip_serializing_if = "Option::is_none")] + pub outbound_i_ps: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "allocatedOutboundPorts", default, skip_serializing_if = "Option::is_none")] + pub allocated_outbound_ports: Option, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[serde(rename = "enableMultipleStandardLoadBalancers", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_standard_load_balancers: Option, +} +pub mod managed_cluster_load_balancer_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ManagedOutboundIPs { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "countIPv6", default, skip_serializing_if = "Option::is_none")] + pub count_i_pv6: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIpPrefixes { + #[serde(rename = "publicIPPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIPs { + #[serde(rename = "publicIPs", default, skip_serializing_if = "Vec::is_empty")] + pub public_i_ps: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterManagedOutboundIpProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterNatGatewayProfile { + #[serde(rename = "managedOutboundIPProfile", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_ip_profile: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentity { + pub name: String, + pub namespace: String, + #[serde(rename = "bindingSelector", default, skip_serializing_if = "Option::is_none")] + pub binding_selector: Option, + pub identity: UserAssignedIdentity, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisioningInfo", default, skip_serializing_if = "Option::is_none")] + pub provisioning_info: Option, +} +pub mod managed_cluster_pod_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Assigned, + Updating, + Deleting, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ProvisioningInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityException { + pub name: String, + pub namespace: String, + #[serde(rename = "podLabels")] + pub pod_labels: serde_json::Value, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "allowNetworkPluginKubenet", default, skip_serializing_if = "Option::is_none")] + pub allow_network_plugin_kubenet: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identities: Vec, + #[serde(rename = "userAssignedIdentityExceptions", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identity_exceptions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProvisioningError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProvisioningErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPoolUpgradeProfile { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "maxAgentPools", default, skip_serializing_if = "Option::is_none")] + pub max_agent_pools: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "dnsPrefix", default, skip_serializing_if = "Option::is_none")] + pub dns_prefix: Option, + #[serde(rename = "fqdnSubdomain", default, skip_serializing_if = "Option::is_none")] + pub fqdn_subdomain: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "privateFQDN", default, skip_serializing_if = "Option::is_none")] + pub private_fqdn: Option, + #[serde(rename = "azurePortalFQDN", default, skip_serializing_if = "Option::is_none")] + pub azure_portal_fqdn: Option, + #[serde(rename = "agentPoolProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_profiles: Vec, + #[serde(rename = "linuxProfile", default, skip_serializing_if = "Option::is_none")] + pub linux_profile: Option, + #[serde(rename = "windowsProfile", default, skip_serializing_if = "Option::is_none")] + pub windows_profile: Option, + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[serde(rename = "addonProfiles", default, skip_serializing_if = "Option::is_none")] + pub addon_profiles: Option, + #[serde(rename = "podIdentityProfile", default, skip_serializing_if = "Option::is_none")] + pub pod_identity_profile: Option, + #[serde(rename = "nodeResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub node_resource_group: Option, + #[serde(rename = "enableRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_rbac: Option, + #[serde(rename = "enablePodSecurityPolicy", default, skip_serializing_if = "Option::is_none")] + pub enable_pod_security_policy: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "aadProfile", default, skip_serializing_if = "Option::is_none")] + pub aad_profile: Option, + #[serde(rename = "autoUpgradeProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_profile: Option, + #[serde(rename = "autoScalerProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_scaler_profile: Option, + #[serde(rename = "apiServerAccessProfile", default, skip_serializing_if = "Option::is_none")] + pub api_server_access_profile: Option, + #[serde(rename = "diskEncryptionSetID", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "identityProfile", default, skip_serializing_if = "Option::is_none")] + pub identity_profile: Option, + #[serde(rename = "privateLinkResources", default, skip_serializing_if = "Vec::is_empty")] + pub private_link_resources: Vec, + #[serde(rename = "disableLocalAccounts", default, skip_serializing_if = "Option::is_none")] + pub disable_local_accounts: Option, + #[serde(rename = "httpProxyConfig", default, skip_serializing_if = "Option::is_none")] + pub http_proxy_config: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +pub mod managed_cluster_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct AutoScalerProfile { + #[serde(rename = "balance-similar-node-groups", default, skip_serializing_if = "Option::is_none")] + pub balance_similar_node_groups: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expander: Option, + #[serde(rename = "max-empty-bulk-delete", default, skip_serializing_if = "Option::is_none")] + pub max_empty_bulk_delete: Option, + #[serde(rename = "max-graceful-termination-sec", default, skip_serializing_if = "Option::is_none")] + pub max_graceful_termination_sec: Option, + #[serde(rename = "max-node-provision-time", default, skip_serializing_if = "Option::is_none")] + pub max_node_provision_time: Option, + #[serde(rename = "max-total-unready-percentage", default, skip_serializing_if = "Option::is_none")] + pub max_total_unready_percentage: Option, + #[serde(rename = "new-pod-scale-up-delay", default, skip_serializing_if = "Option::is_none")] + pub new_pod_scale_up_delay: Option, + #[serde(rename = "ok-total-unready-count", default, skip_serializing_if = "Option::is_none")] + pub ok_total_unready_count: Option, + #[serde(rename = "scan-interval", default, skip_serializing_if = "Option::is_none")] + pub scan_interval: Option, + #[serde(rename = "scale-down-delay-after-add", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_add: Option, + #[serde(rename = "scale-down-delay-after-delete", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_delete: Option, + #[serde(rename = "scale-down-delay-after-failure", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_failure: Option, + #[serde(rename = "scale-down-unneeded-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unneeded_time: Option, + #[serde(rename = "scale-down-unready-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unready_time: Option, + #[serde(rename = "scale-down-utilization-threshold", default, skip_serializing_if = "Option::is_none")] + pub scale_down_utilization_threshold: Option, + #[serde(rename = "skip-nodes-with-local-storage", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_local_storage: Option, + #[serde(rename = "skip-nodes-with-system-pods", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_system_pods: Option, + } + pub mod auto_scaler_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Expander { + #[serde(rename = "least-waste")] + LeastWaste, + #[serde(rename = "most-pods")] + MostPods, + #[serde(rename = "priority")] + Priority, + #[serde(rename = "random")] + Random, + } + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod managed_cluster_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Paid, + Free, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSecurityProfile { + #[serde(rename = "azureDefender", default, skip_serializing_if = "Option::is_none")] + pub azure_defender: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSecurityProfileAzureDefender { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "logAnalyticsWorkspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub log_analytics_workspace_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterServicePrincipalProfile { + #[serde(rename = "clientId")] + pub client_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: ManagedClusterUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfileProperties { + #[serde(rename = "controlPlaneProfile")] + pub control_plane_profile: ManagedClusterPoolUpgradeProfile, + #[serde(rename = "agentPoolProfiles")] + pub agent_pool_profiles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterWindowsProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "enableCSIProxy", default, skip_serializing_if = "Option::is_none")] + pub enable_csi_proxy: Option, + #[serde(rename = "gmsaProfile", default, skip_serializing_if = "Option::is_none")] + pub gmsa_profile: Option, +} +pub mod managed_cluster_windows_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + None, + #[serde(rename = "Windows_Server")] + WindowsServer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsDiskType { + Managed, + Ephemeral, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: OsOptionPropertyList, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProperty { + #[serde(rename = "os-type")] + pub os_type: String, + #[serde(rename = "enable-fips-image")] + pub enable_fips_image: bool, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionPropertyList { + #[serde(rename = "osOptionPropertyList")] + pub os_option_property_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Ossku { + Ubuntu, + #[serde(rename = "CBLMariner")] + CblMariner, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsType { + Linux, + Windows, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValue { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValueDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpointCollection { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +pub mod power_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + Running, + Stopped, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, +} +pub mod private_endpoint_connection_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "privateLinkServiceID", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourcesListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +pub type ProximityPlacementGroupId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandRequest { + pub command: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[serde(rename = "clusterToken", default, skip_serializing_if = "Option::is_none")] + pub cluster_token: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleDownMode { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetEvictionPolicy { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetPriority { + Spot, + Regular, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Snapshot { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotProperties { + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[serde(rename = "snapshotType", default, skip_serializing_if = "Option::is_none")] + pub snapshot_type: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osSku", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SnapshotType { + NodePool, +} +pub type SpotMaxPrice = f64; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SysctlConfig { + #[serde(rename = "netCoreSomaxconn", default, skip_serializing_if = "Option::is_none")] + pub net_core_somaxconn: Option, + #[serde(rename = "netCoreNetdevMaxBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_core_netdev_max_backlog: Option, + #[serde(rename = "netCoreRmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_default: Option, + #[serde(rename = "netCoreRmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_max: Option, + #[serde(rename = "netCoreWmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_default: Option, + #[serde(rename = "netCoreWmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_max: Option, + #[serde(rename = "netCoreOptmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_optmem_max: Option, + #[serde(rename = "netIpv4TcpMaxSynBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_syn_backlog: Option, + #[serde(rename = "netIpv4TcpMaxTwBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_tw_buckets: Option, + #[serde(rename = "netIpv4TcpFinTimeout", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_fin_timeout: Option, + #[serde(rename = "netIpv4TcpKeepaliveTime", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_time: Option, + #[serde(rename = "netIpv4TcpKeepaliveProbes", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_probes: Option, + #[serde(rename = "netIpv4TcpkeepaliveIntvl", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcpkeepalive_intvl: Option, + #[serde(rename = "netIpv4TcpTwReuse", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_tw_reuse: Option, + #[serde(rename = "netIpv4IpLocalPortRange", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_ip_local_port_range: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh1", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh1: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh2", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh2: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh3", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh3: Option, + #[serde(rename = "netNetfilterNfConntrackMax", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_max: Option, + #[serde(rename = "netNetfilterNfConntrackBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_buckets: Option, + #[serde(rename = "fsInotifyMaxUserWatches", default, skip_serializing_if = "Option::is_none")] + pub fs_inotify_max_user_watches: Option, + #[serde(rename = "fsFileMax", default, skip_serializing_if = "Option::is_none")] + pub fs_file_max: Option, + #[serde(rename = "fsAioMaxNr", default, skip_serializing_if = "Option::is_none")] + pub fs_aio_max_nr: Option, + #[serde(rename = "fsNrOpen", default, skip_serializing_if = "Option::is_none")] + pub fs_nr_open: Option, + #[serde(rename = "kernelThreadsMax", default, skip_serializing_if = "Option::is_none")] + pub kernel_threads_max: Option, + #[serde(rename = "vmMaxMapCount", default, skip_serializing_if = "Option::is_none")] + pub vm_max_map_count: Option, + #[serde(rename = "vmSwappiness", default, skip_serializing_if = "Option::is_none")] + pub vm_swappiness: Option, + #[serde(rename = "vmVfsCachePressure", default, skip_serializing_if = "Option::is_none")] + pub vm_vfs_cache_pressure: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagsObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimeInWeek { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[serde(rename = "hourSlots", default, skip_serializing_if = "Vec::is_empty")] + pub hour_slots: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimeSpan { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentity { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WeekDay { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WindowsGmsaProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "dnsServer", default, skip_serializing_if = "Option::is_none")] + pub dns_server: Option, + #[serde(rename = "rootDomainName", default, skip_serializing_if = "Option::is_none")] + pub root_domain_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WorkloadRuntime { + #[serde(rename = "OCIContainer")] + OciContainer, + WasmWasi, +} diff --git a/services/mgmt/containerservice/src/package_2021_10/operations.rs b/services/mgmt/containerservice/src/package_2021_10/operations.rs new file mode 100644 index 0000000000..98474a8d81 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_10/operations.rs @@ -0,0 +1,4265 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn agent_pools(&self) -> agent_pools::Client { + agent_pools::Client(self.clone()) + } + pub fn maintenance_configurations(&self) -> maintenance_configurations::Client { + maintenance_configurations::Client(self.clone()) + } + pub fn managed_clusters(&self) -> managed_clusters::Client { + managed_clusters::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn resolve_private_link_service_id(&self) -> resolve_private_link_service_id::Client { + resolve_private_link_service_id::Client(self.clone()) + } + pub fn snapshots(&self) -> snapshots::Client { + snapshots::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ManagedClusters_GetOsOptions(#[from] managed_clusters::get_os_options::Error), + #[error(transparent)] + ManagedClusters_List(#[from] managed_clusters::list::Error), + #[error(transparent)] + ManagedClusters_ListByResourceGroup(#[from] managed_clusters::list_by_resource_group::Error), + #[error(transparent)] + ManagedClusters_GetUpgradeProfile(#[from] managed_clusters::get_upgrade_profile::Error), + #[error(transparent)] + ManagedClusters_GetAccessProfile(#[from] managed_clusters::get_access_profile::Error), + #[error(transparent)] + ManagedClusters_ListClusterAdminCredentials(#[from] managed_clusters::list_cluster_admin_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterUserCredentials(#[from] managed_clusters::list_cluster_user_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterMonitoringUserCredentials(#[from] managed_clusters::list_cluster_monitoring_user_credentials::Error), + #[error(transparent)] + ManagedClusters_Get(#[from] managed_clusters::get::Error), + #[error(transparent)] + ManagedClusters_CreateOrUpdate(#[from] managed_clusters::create_or_update::Error), + #[error(transparent)] + ManagedClusters_UpdateTags(#[from] managed_clusters::update_tags::Error), + #[error(transparent)] + ManagedClusters_Delete(#[from] managed_clusters::delete::Error), + #[error(transparent)] + MaintenanceConfigurations_ListByManagedCluster(#[from] maintenance_configurations::list_by_managed_cluster::Error), + #[error(transparent)] + MaintenanceConfigurations_Get(#[from] maintenance_configurations::get::Error), + #[error(transparent)] + MaintenanceConfigurations_CreateOrUpdate(#[from] maintenance_configurations::create_or_update::Error), + #[error(transparent)] + MaintenanceConfigurations_Delete(#[from] maintenance_configurations::delete::Error), + #[error(transparent)] + AgentPools_List(#[from] agent_pools::list::Error), + #[error(transparent)] + AgentPools_Get(#[from] agent_pools::get::Error), + #[error(transparent)] + AgentPools_CreateOrUpdate(#[from] agent_pools::create_or_update::Error), + #[error(transparent)] + AgentPools_Delete(#[from] agent_pools::delete::Error), + #[error(transparent)] + AgentPools_GetUpgradeProfile(#[from] agent_pools::get_upgrade_profile::Error), + #[error(transparent)] + AgentPools_GetAvailableAgentPoolVersions(#[from] agent_pools::get_available_agent_pool_versions::Error), + #[error(transparent)] + ManagedClusters_ResetServicePrincipalProfile(#[from] managed_clusters::reset_service_principal_profile::Error), + #[error(transparent)] + ManagedClusters_ResetAadProfile(#[from] managed_clusters::reset_aad_profile::Error), + #[error(transparent)] + ManagedClusters_RotateClusterCertificates(#[from] managed_clusters::rotate_cluster_certificates::Error), + #[error(transparent)] + ManagedClusters_Stop(#[from] managed_clusters::stop::Error), + #[error(transparent)] + ManagedClusters_Start(#[from] managed_clusters::start::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Update(#[from] private_endpoint_connections::update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + AgentPools_UpgradeNodeImageVersion(#[from] agent_pools::upgrade_node_image_version::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + ResolvePrivateLinkServiceId_Post(#[from] resolve_private_link_service_id::post::Error), + #[error(transparent)] + ManagedClusters_RunCommand(#[from] managed_clusters::run_command::Error), + #[error(transparent)] + ManagedClusters_GetCommandResult(#[from] managed_clusters::get_command_result::Error), + #[error(transparent)] + ManagedClusters_ListOutboundNetworkDependenciesEndpoints(#[from] managed_clusters::list_outbound_network_dependencies_endpoints::Error), + #[error(transparent)] + Snapshots_List(#[from] snapshots::list::Error), + #[error(transparent)] + Snapshots_ListByResourceGroup(#[from] snapshots::list_by_resource_group::Error), + #[error(transparent)] + Snapshots_Get(#[from] snapshots::get::Error), + #[error(transparent)] + Snapshots_CreateOrUpdate(#[from] snapshots::create_or_update::Error), + #[error(transparent)] + Snapshots_UpdateTags(#[from] snapshots::update_tags::Error), + #[error(transparent)] + Snapshots_Delete(#[from] snapshots::delete::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of operations."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_clusters { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets supported OS options in the specified subscription."] + pub fn get_os_options(&self, subscription_id: impl Into, location: impl Into) -> get_os_options::Builder { + get_os_options::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + resource_type: None, + } + } + #[doc = "Gets a list of managed clusters in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists managed clusters in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets the upgrade profile of a managed cluster."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets an access profile of a managed cluster."] + pub fn get_access_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + role_name: impl Into, + ) -> get_access_profile::Builder { + get_access_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + role_name: role_name.into(), + } + } + #[doc = "Lists the admin credentials of a managed cluster."] + pub fn list_cluster_admin_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_admin_credentials::Builder { + list_cluster_admin_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the user credentials of a managed cluster."] + pub fn list_cluster_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_user_credentials::Builder { + list_cluster_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the cluster monitoring user credentials of a managed cluster."] + pub fn list_cluster_monitoring_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_monitoring_user_credentials::Builder { + list_cluster_monitoring_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Gets a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a managed cluster."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Reset the Service Principal Profile of a managed cluster."] + pub fn reset_service_principal_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_service_principal_profile::Builder { + reset_service_principal_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Reset the AAD Profile of a managed cluster."] + pub fn reset_aad_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_aad_profile::Builder { + reset_aad_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Rotates the certificates of a managed cluster."] + pub fn rotate_cluster_certificates( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> rotate_cluster_certificates::Builder { + rotate_cluster_certificates::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Stops a Managed Cluster"] + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Starts a previously stopped Managed Cluster"] + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Submits a command to run against the Managed Cluster."] + pub fn run_command( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + request_payload: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + request_payload: request_payload.into(), + } + } + #[doc = "Gets the results of a command which has been run on the Managed Cluster."] + pub fn get_command_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + command_id: impl Into, + ) -> get_command_result::Builder { + get_command_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + command_id: command_id.into(), + } + } + #[doc = "Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster."] + pub fn list_outbound_network_dependencies_endpoints( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_outbound_network_dependencies_endpoints::Builder { + list_outbound_network_dependencies_endpoints::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod get_os_options { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) resource_type: Option, + } + impl Builder { + pub fn resource_type(mut self, resource_type: impl Into) -> Self { + self.resource_type = Some(resource_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/locations/{}/osOptions/default", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(resource_type) = &self.resource_type { + url.query_pairs_mut().append_pair("resource-type", resource_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsOptionProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_access_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) role_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/accessProfiles/{}/listCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterAccessProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_admin_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterAdminCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_monitoring_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterMonitoringUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedCluster), + Created201(models::ManagedCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedCluster, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_service_principal_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterServicePrincipalProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetServicePrincipalProfile" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_aad_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterAadProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetAADProfile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rotate_cluster_certificates { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/rotateClusterCertificates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) request_payload: models::RunCommandRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/runCommand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_command_result { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) command_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/commandResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.command_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_outbound_network_dependencies_endpoints { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundEnvironmentEndpointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod maintenance_configurations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of maintenance configurations in the specified managed cluster."] + pub fn list_by_managed_cluster( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_by_managed_cluster::Builder { + list_by_managed_cluster::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified maintenance configuration of a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + #[doc = "Creates or updates a maintenance configuration in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a maintenance configuration."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + } + pub mod list_by_managed_cluster { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + pub(crate) parameters: models::MaintenanceConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod agent_pools { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of agent pools in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified managed cluster agent pool."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Creates or updates an agent pool in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes an agent pool in the specified managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets the upgrade profile for an agent pool."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets a list of supported Kubernetes versions for the specified agent pool."] + pub fn get_available_agent_pool_versions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_available_agent_pool_versions::Builder { + get_available_agent_pool_versions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Upgrades the node image version of an agent pool to the latest."] + pub fn upgrade_node_image_version( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> upgrade_node_image_version::Builder { + upgrade_node_image_version::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + pub(crate) parameters: models::AgentPool, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_available_agent_pool_versions { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/availableAgentPoolVersions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolAvailableVersions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod upgrade_node_image_version { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeNodeImageVersion" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private endpoint connections in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified private endpoint connection."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + #[doc = "Updates a private endpoint connection."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a private endpoint connection."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private link resources in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateLinkResources" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resolve_private_link_service_id { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the private link service ID for the specified managed cluster."] + pub fn post( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> post::Builder { + post::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + } + pub mod post { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::PrivateLinkResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resolvePrivateLinkServiceId" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod snapshots { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of snapshots in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists snapshots in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a snapshot."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a snapshot."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a snapshot."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a snapshot."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Created201(models::Snapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::Snapshot, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/containerservice/src/package_2021_10_01_only/mod.rs b/services/mgmt/containerservice/src/package_2021_10_01_only/mod.rs new file mode 100644 index 0000000000..cdd7552b47 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_10_01_only/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-10-01"; diff --git a/services/mgmt/containerservice/src/package_2021_10_01_only/models.rs b/services/mgmt/containerservice/src/package_2021_10_01_only/models.rs new file mode 100644 index 0000000000..76670bc78c --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_10_01_only/models.rs @@ -0,0 +1,1645 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccessProfile { + #[serde(rename = "kubeConfig", default, skip_serializing_if = "Option::is_none")] + pub kube_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolAvailableVersionsProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersionsProperties { + #[serde(rename = "agentPoolVersions", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_versions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolMode { + System, + User, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolType { + VirtualMachineScaleSets, + AvailabilitySet, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfileProperties { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, + #[serde(rename = "latestNodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_node_image_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeSettings { + #[serde(rename = "maxSurge", default, skip_serializing_if = "Option::is_none")] + pub max_surge: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommandResultProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "exitCode", default, skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + #[serde(rename = "startedAt", default, skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[serde(rename = "finishedAt", default, skip_serializing_if = "Option::is_none")] + pub finished_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub logs: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceDiagnosticsProfile { + #[serde(rename = "vmDiagnostics")] + pub vm_diagnostics: ContainerServiceVmDiagnostics, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceLinuxProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + pub ssh: ContainerServiceSshConfiguration, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceMasterProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "dnsPrefix")] + pub dns_prefix: String, + #[serde(rename = "vmSize")] + pub vm_size: ContainerServiceVmSize, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "firstConsecutiveStaticIP", default, skip_serializing_if = "Option::is_none")] + pub first_consecutive_static_ip: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, +} +pub mod container_service_master_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Count {} +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceNetworkProfile { + #[serde(rename = "networkPlugin", default, skip_serializing_if = "Option::is_none")] + pub network_plugin: Option, + #[serde(rename = "networkPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_policy: Option, + #[serde(rename = "networkMode", default, skip_serializing_if = "Option::is_none")] + pub network_mode: Option, + #[serde(rename = "podCidr", default, skip_serializing_if = "Option::is_none")] + pub pod_cidr: Option, + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, + #[serde(rename = "dnsServiceIP", default, skip_serializing_if = "Option::is_none")] + pub dns_service_ip: Option, + #[serde(rename = "dockerBridgeCidr", default, skip_serializing_if = "Option::is_none")] + pub docker_bridge_cidr: Option, + #[serde(rename = "outboundType", default, skip_serializing_if = "Option::is_none")] + pub outbound_type: Option, + #[serde(rename = "loadBalancerSku", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_sku: Option, + #[serde(rename = "loadBalancerProfile", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_profile: Option, + #[serde(rename = "natGatewayProfile", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway_profile: Option, + #[serde(rename = "podCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub pod_cidrs: Vec, + #[serde(rename = "serviceCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub service_cidrs: Vec, + #[serde(rename = "ipFamilies", default, skip_serializing_if = "Vec::is_empty")] + pub ip_families: Vec, +} +pub mod container_service_network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPlugin { + #[serde(rename = "azure")] + Azure, + #[serde(rename = "kubenet")] + Kubenet, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPolicy { + #[serde(rename = "calico")] + Calico, + #[serde(rename = "azure")] + Azure, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkMode { + #[serde(rename = "transparent")] + Transparent, + #[serde(rename = "bridge")] + Bridge, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OutboundType { + #[serde(rename = "loadBalancer")] + LoadBalancer, + #[serde(rename = "userDefinedRouting")] + UserDefinedRouting, + #[serde(rename = "managedNATGateway")] + ManagedNatGateway, + #[serde(rename = "userAssignedNATGateway")] + UserAssignedNatGateway, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoadBalancerSku { + #[serde(rename = "standard")] + Standard, + #[serde(rename = "basic")] + Basic, + } +} +pub type ContainerServiceOsDisk = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshConfiguration { + #[serde(rename = "publicKeys")] + pub public_keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshPublicKey { + #[serde(rename = "keyData")] + pub key_data: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceStorageProfile { + StorageAccount, + ManagedDisks, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceVmDiagnostics { + pub enabled: bool, + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceVmSize { + #[serde(rename = "Standard_A1")] + StandardA1, + #[serde(rename = "Standard_A10")] + StandardA10, + #[serde(rename = "Standard_A11")] + StandardA11, + #[serde(rename = "Standard_A1_v2")] + StandardA1V2, + #[serde(rename = "Standard_A2")] + StandardA2, + #[serde(rename = "Standard_A2_v2")] + StandardA2V2, + #[serde(rename = "Standard_A2m_v2")] + StandardA2mV2, + #[serde(rename = "Standard_A3")] + StandardA3, + #[serde(rename = "Standard_A4")] + StandardA4, + #[serde(rename = "Standard_A4_v2")] + StandardA4V2, + #[serde(rename = "Standard_A4m_v2")] + StandardA4mV2, + #[serde(rename = "Standard_A5")] + StandardA5, + #[serde(rename = "Standard_A6")] + StandardA6, + #[serde(rename = "Standard_A7")] + StandardA7, + #[serde(rename = "Standard_A8")] + StandardA8, + #[serde(rename = "Standard_A8_v2")] + StandardA8V2, + #[serde(rename = "Standard_A8m_v2")] + StandardA8mV2, + #[serde(rename = "Standard_A9")] + StandardA9, + #[serde(rename = "Standard_B2ms")] + StandardB2ms, + #[serde(rename = "Standard_B2s")] + StandardB2s, + #[serde(rename = "Standard_B4ms")] + StandardB4ms, + #[serde(rename = "Standard_B8ms")] + StandardB8ms, + #[serde(rename = "Standard_D1")] + StandardD1, + #[serde(rename = "Standard_D11")] + StandardD11, + #[serde(rename = "Standard_D11_v2")] + StandardD11V2, + #[serde(rename = "Standard_D11_v2_Promo")] + StandardD11V2Promo, + #[serde(rename = "Standard_D12")] + StandardD12, + #[serde(rename = "Standard_D12_v2")] + StandardD12V2, + #[serde(rename = "Standard_D12_v2_Promo")] + StandardD12V2Promo, + #[serde(rename = "Standard_D13")] + StandardD13, + #[serde(rename = "Standard_D13_v2")] + StandardD13V2, + #[serde(rename = "Standard_D13_v2_Promo")] + StandardD13V2Promo, + #[serde(rename = "Standard_D14")] + StandardD14, + #[serde(rename = "Standard_D14_v2")] + StandardD14V2, + #[serde(rename = "Standard_D14_v2_Promo")] + StandardD14V2Promo, + #[serde(rename = "Standard_D15_v2")] + StandardD15V2, + #[serde(rename = "Standard_D16_v3")] + StandardD16V3, + #[serde(rename = "Standard_D16s_v3")] + StandardD16sV3, + #[serde(rename = "Standard_D1_v2")] + StandardD1V2, + #[serde(rename = "Standard_D2")] + StandardD2, + #[serde(rename = "Standard_D2_v2")] + StandardD2V2, + #[serde(rename = "Standard_D2_v2_Promo")] + StandardD2V2Promo, + #[serde(rename = "Standard_D2_v3")] + StandardD2V3, + #[serde(rename = "Standard_D2s_v3")] + StandardD2sV3, + #[serde(rename = "Standard_D3")] + StandardD3, + #[serde(rename = "Standard_D32_v3")] + StandardD32V3, + #[serde(rename = "Standard_D32s_v3")] + StandardD32sV3, + #[serde(rename = "Standard_D3_v2")] + StandardD3V2, + #[serde(rename = "Standard_D3_v2_Promo")] + StandardD3V2Promo, + #[serde(rename = "Standard_D4")] + StandardD4, + #[serde(rename = "Standard_D4_v2")] + StandardD4V2, + #[serde(rename = "Standard_D4_v2_Promo")] + StandardD4V2Promo, + #[serde(rename = "Standard_D4_v3")] + StandardD4V3, + #[serde(rename = "Standard_D4s_v3")] + StandardD4sV3, + #[serde(rename = "Standard_D5_v2")] + StandardD5V2, + #[serde(rename = "Standard_D5_v2_Promo")] + StandardD5V2Promo, + #[serde(rename = "Standard_D64_v3")] + StandardD64V3, + #[serde(rename = "Standard_D64s_v3")] + StandardD64sV3, + #[serde(rename = "Standard_D8_v3")] + StandardD8V3, + #[serde(rename = "Standard_D8s_v3")] + StandardD8sV3, + #[serde(rename = "Standard_DS1")] + StandardDs1, + #[serde(rename = "Standard_DS11")] + StandardDs11, + #[serde(rename = "Standard_DS11_v2")] + StandardDs11V2, + #[serde(rename = "Standard_DS11_v2_Promo")] + StandardDs11V2Promo, + #[serde(rename = "Standard_DS12")] + StandardDs12, + #[serde(rename = "Standard_DS12_v2")] + StandardDs12V2, + #[serde(rename = "Standard_DS12_v2_Promo")] + StandardDs12V2Promo, + #[serde(rename = "Standard_DS13")] + StandardDs13, + #[serde(rename = "Standard_DS13-2_v2")] + StandardDs132V2, + #[serde(rename = "Standard_DS13-4_v2")] + StandardDs134V2, + #[serde(rename = "Standard_DS13_v2")] + StandardDs13V2, + #[serde(rename = "Standard_DS13_v2_Promo")] + StandardDs13V2Promo, + #[serde(rename = "Standard_DS14")] + StandardDs14, + #[serde(rename = "Standard_DS14-4_v2")] + StandardDs144V2, + #[serde(rename = "Standard_DS14-8_v2")] + StandardDs148V2, + #[serde(rename = "Standard_DS14_v2")] + StandardDs14V2, + #[serde(rename = "Standard_DS14_v2_Promo")] + StandardDs14V2Promo, + #[serde(rename = "Standard_DS15_v2")] + StandardDs15V2, + #[serde(rename = "Standard_DS1_v2")] + StandardDs1V2, + #[serde(rename = "Standard_DS2")] + StandardDs2, + #[serde(rename = "Standard_DS2_v2")] + StandardDs2V2, + #[serde(rename = "Standard_DS2_v2_Promo")] + StandardDs2V2Promo, + #[serde(rename = "Standard_DS3")] + StandardDs3, + #[serde(rename = "Standard_DS3_v2")] + StandardDs3V2, + #[serde(rename = "Standard_DS3_v2_Promo")] + StandardDs3V2Promo, + #[serde(rename = "Standard_DS4")] + StandardDs4, + #[serde(rename = "Standard_DS4_v2")] + StandardDs4V2, + #[serde(rename = "Standard_DS4_v2_Promo")] + StandardDs4V2Promo, + #[serde(rename = "Standard_DS5_v2")] + StandardDs5V2, + #[serde(rename = "Standard_DS5_v2_Promo")] + StandardDs5V2Promo, + #[serde(rename = "Standard_E16_v3")] + StandardE16V3, + #[serde(rename = "Standard_E16s_v3")] + StandardE16sV3, + #[serde(rename = "Standard_E2_v3")] + StandardE2V3, + #[serde(rename = "Standard_E2s_v3")] + StandardE2sV3, + #[serde(rename = "Standard_E32-16s_v3")] + StandardE3216sV3, + #[serde(rename = "Standard_E32-8s_v3")] + StandardE328sV3, + #[serde(rename = "Standard_E32_v3")] + StandardE32V3, + #[serde(rename = "Standard_E32s_v3")] + StandardE32sV3, + #[serde(rename = "Standard_E4_v3")] + StandardE4V3, + #[serde(rename = "Standard_E4s_v3")] + StandardE4sV3, + #[serde(rename = "Standard_E64-16s_v3")] + StandardE6416sV3, + #[serde(rename = "Standard_E64-32s_v3")] + StandardE6432sV3, + #[serde(rename = "Standard_E64_v3")] + StandardE64V3, + #[serde(rename = "Standard_E64s_v3")] + StandardE64sV3, + #[serde(rename = "Standard_E8_v3")] + StandardE8V3, + #[serde(rename = "Standard_E8s_v3")] + StandardE8sV3, + #[serde(rename = "Standard_F1")] + StandardF1, + #[serde(rename = "Standard_F16")] + StandardF16, + #[serde(rename = "Standard_F16s")] + StandardF16s, + #[serde(rename = "Standard_F16s_v2")] + StandardF16sV2, + #[serde(rename = "Standard_F1s")] + StandardF1s, + #[serde(rename = "Standard_F2")] + StandardF2, + #[serde(rename = "Standard_F2s")] + StandardF2s, + #[serde(rename = "Standard_F2s_v2")] + StandardF2sV2, + #[serde(rename = "Standard_F32s_v2")] + StandardF32sV2, + #[serde(rename = "Standard_F4")] + StandardF4, + #[serde(rename = "Standard_F4s")] + StandardF4s, + #[serde(rename = "Standard_F4s_v2")] + StandardF4sV2, + #[serde(rename = "Standard_F64s_v2")] + StandardF64sV2, + #[serde(rename = "Standard_F72s_v2")] + StandardF72sV2, + #[serde(rename = "Standard_F8")] + StandardF8, + #[serde(rename = "Standard_F8s")] + StandardF8s, + #[serde(rename = "Standard_F8s_v2")] + StandardF8sV2, + #[serde(rename = "Standard_G1")] + StandardG1, + #[serde(rename = "Standard_G2")] + StandardG2, + #[serde(rename = "Standard_G3")] + StandardG3, + #[serde(rename = "Standard_G4")] + StandardG4, + #[serde(rename = "Standard_G5")] + StandardG5, + #[serde(rename = "Standard_GS1")] + StandardGs1, + #[serde(rename = "Standard_GS2")] + StandardGs2, + #[serde(rename = "Standard_GS3")] + StandardGs3, + #[serde(rename = "Standard_GS4")] + StandardGs4, + #[serde(rename = "Standard_GS4-4")] + StandardGs44, + #[serde(rename = "Standard_GS4-8")] + StandardGs48, + #[serde(rename = "Standard_GS5")] + StandardGs5, + #[serde(rename = "Standard_GS5-16")] + StandardGs516, + #[serde(rename = "Standard_GS5-8")] + StandardGs58, + #[serde(rename = "Standard_H16")] + StandardH16, + #[serde(rename = "Standard_H16m")] + StandardH16m, + #[serde(rename = "Standard_H16mr")] + StandardH16mr, + #[serde(rename = "Standard_H16r")] + StandardH16r, + #[serde(rename = "Standard_H8")] + StandardH8, + #[serde(rename = "Standard_H8m")] + StandardH8m, + #[serde(rename = "Standard_L16s")] + StandardL16s, + #[serde(rename = "Standard_L32s")] + StandardL32s, + #[serde(rename = "Standard_L4s")] + StandardL4s, + #[serde(rename = "Standard_L8s")] + StandardL8s, + #[serde(rename = "Standard_M128-32ms")] + StandardM12832ms, + #[serde(rename = "Standard_M128-64ms")] + StandardM12864ms, + #[serde(rename = "Standard_M128ms")] + StandardM128ms, + #[serde(rename = "Standard_M128s")] + StandardM128s, + #[serde(rename = "Standard_M64-16ms")] + StandardM6416ms, + #[serde(rename = "Standard_M64-32ms")] + StandardM6432ms, + #[serde(rename = "Standard_M64ms")] + StandardM64ms, + #[serde(rename = "Standard_M64s")] + StandardM64s, + #[serde(rename = "Standard_NC12")] + StandardNc12, + #[serde(rename = "Standard_NC12s_v2")] + StandardNc12sV2, + #[serde(rename = "Standard_NC12s_v3")] + StandardNc12sV3, + #[serde(rename = "Standard_NC24")] + StandardNc24, + #[serde(rename = "Standard_NC24r")] + StandardNc24r, + #[serde(rename = "Standard_NC24rs_v2")] + StandardNc24rsV2, + #[serde(rename = "Standard_NC24rs_v3")] + StandardNc24rsV3, + #[serde(rename = "Standard_NC24s_v2")] + StandardNc24sV2, + #[serde(rename = "Standard_NC24s_v3")] + StandardNc24sV3, + #[serde(rename = "Standard_NC6")] + StandardNc6, + #[serde(rename = "Standard_NC6s_v2")] + StandardNc6sV2, + #[serde(rename = "Standard_NC6s_v3")] + StandardNc6sV3, + #[serde(rename = "Standard_ND12s")] + StandardNd12s, + #[serde(rename = "Standard_ND24rs")] + StandardNd24rs, + #[serde(rename = "Standard_ND24s")] + StandardNd24s, + #[serde(rename = "Standard_ND6s")] + StandardNd6s, + #[serde(rename = "Standard_NV12")] + StandardNv12, + #[serde(rename = "Standard_NV24")] + StandardNv24, + #[serde(rename = "Standard_NV6")] + StandardNv6, +} +pub type ContainerServiceVnetSubnetId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreationData { + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResults { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub kubeconfigs: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointDependency { + #[serde(rename = "domainName", default, skip_serializing_if = "Option::is_none")] + pub domain_name: Option, + #[serde(rename = "endpointDetails", default, skip_serializing_if = "Vec::is_empty")] + pub endpoint_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointDetail { + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExtendedLocationType { + EdgeZone, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum GpuInstanceProfile { + #[serde(rename = "MIG1g")] + Mig1g, + #[serde(rename = "MIG2g")] + Mig2g, + #[serde(rename = "MIG3g")] + Mig3g, + #[serde(rename = "MIG4g")] + Mig4g, + #[serde(rename = "MIG7g")] + Mig7g, +} +pub type HourInDay = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubeletConfig { + #[serde(rename = "cpuManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub cpu_manager_policy: Option, + #[serde(rename = "cpuCfsQuota", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota: Option, + #[serde(rename = "cpuCfsQuotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota_period: Option, + #[serde(rename = "imageGcHighThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_high_threshold: Option, + #[serde(rename = "imageGcLowThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_low_threshold: Option, + #[serde(rename = "topologyManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub topology_manager_policy: Option, + #[serde(rename = "allowedUnsafeSysctls", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_unsafe_sysctls: Vec, + #[serde(rename = "failSwapOn", default, skip_serializing_if = "Option::is_none")] + pub fail_swap_on: Option, + #[serde(rename = "containerLogMaxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_size_mb: Option, + #[serde(rename = "containerLogMaxFiles", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_files: Option, + #[serde(rename = "podMaxPids", default, skip_serializing_if = "Option::is_none")] + pub pod_max_pids: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KubeletDiskType { + #[serde(rename = "OS")] + Os, + Temporary, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinuxOsConfig { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sysctls: Option, + #[serde(rename = "transparentHugePageEnabled", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_enabled: Option, + #[serde(rename = "transparentHugePageDefrag", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_defrag: Option, + #[serde(rename = "swapFileSizeMB", default, skip_serializing_if = "Option::is_none")] + pub swap_file_size_mb: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfigurationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfigurationProperties { + #[serde(rename = "timeInWeek", default, skip_serializing_if = "Vec::is_empty")] + pub time_in_week: Vec, + #[serde(rename = "notAllowedTime", default, skip_serializing_if = "Vec::is_empty")] + pub not_allowed_time: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCluster { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAadProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub managed: Option, + #[serde(rename = "enableAzureRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_azure_rbac: Option, + #[serde(rename = "adminGroupObjectIDs", default, skip_serializing_if = "Vec::is_empty")] + pub admin_group_object_i_ds: Vec, + #[serde(rename = "clientAppID", default, skip_serializing_if = "Option::is_none")] + pub client_app_id: Option, + #[serde(rename = "serverAppID", default, skip_serializing_if = "Option::is_none")] + pub server_app_id: Option, + #[serde(rename = "serverAppSecret", default, skip_serializing_if = "Option::is_none")] + pub server_app_secret: Option, + #[serde(rename = "tenantID", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterApiServerAccessProfile { + #[serde(rename = "authorizedIPRanges", default, skip_serializing_if = "Vec::is_empty")] + pub authorized_ip_ranges: Vec, + #[serde(rename = "enablePrivateCluster", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster: Option, + #[serde(rename = "privateDNSZone", default, skip_serializing_if = "Option::is_none")] + pub private_dns_zone: Option, + #[serde(rename = "enablePrivateClusterPublicFQDN", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster_public_fqdn: Option, + #[serde(rename = "disableRunCommand", default, skip_serializing_if = "Option::is_none")] + pub disable_run_command: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAccessProfile { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAddonProfile { + pub enabled: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub config: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfile { + #[serde(flatten)] + pub managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties, + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfileProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "osDiskType", default, skip_serializing_if = "Option::is_none")] + pub os_disk_type: Option, + #[serde(rename = "kubeletDiskType", default, skip_serializing_if = "Option::is_none")] + pub kubelet_disk_type: Option, + #[serde(rename = "workloadRuntime", default, skip_serializing_if = "Option::is_none")] + pub workload_runtime: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "podSubnetID", default, skip_serializing_if = "Option::is_none")] + pub pod_subnet_id: Option, + #[serde(rename = "maxPods", default, skip_serializing_if = "Option::is_none")] + pub max_pods: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osSKU", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[serde(rename = "maxCount", default, skip_serializing_if = "Option::is_none")] + pub max_count: Option, + #[serde(rename = "minCount", default, skip_serializing_if = "Option::is_none")] + pub min_count: Option, + #[serde(rename = "enableAutoScaling", default, skip_serializing_if = "Option::is_none")] + pub enable_auto_scaling: Option, + #[serde(rename = "scaleDownMode", default, skip_serializing_if = "Option::is_none")] + pub scale_down_mode: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "orchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "upgradeSettings", default, skip_serializing_if = "Option::is_none")] + pub upgrade_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "availabilityZones", default, skip_serializing_if = "Vec::is_empty")] + pub availability_zones: Vec, + #[serde(rename = "enableNodePublicIP", default, skip_serializing_if = "Option::is_none")] + pub enable_node_public_ip: Option, + #[serde(rename = "nodePublicIPPrefixID", default, skip_serializing_if = "Option::is_none")] + pub node_public_ip_prefix_id: Option, + #[serde(rename = "scaleSetPriority", default, skip_serializing_if = "Option::is_none")] + pub scale_set_priority: Option, + #[serde(rename = "scaleSetEvictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_set_eviction_policy: Option, + #[serde(rename = "spotMaxPrice", default, skip_serializing_if = "Option::is_none")] + pub spot_max_price: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "nodeLabels", default, skip_serializing_if = "Option::is_none")] + pub node_labels: Option, + #[serde(rename = "nodeTaints", default, skip_serializing_if = "Vec::is_empty")] + pub node_taints: Vec, + #[serde(rename = "proximityPlacementGroupID", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group_id: Option, + #[serde(rename = "kubeletConfig", default, skip_serializing_if = "Option::is_none")] + pub kubelet_config: Option, + #[serde(rename = "linuxOSConfig", default, skip_serializing_if = "Option::is_none")] + pub linux_os_config: Option, + #[serde(rename = "enableEncryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub enable_encryption_at_host: Option, + #[serde(rename = "enableUltraSSD", default, skip_serializing_if = "Option::is_none")] + pub enable_ultra_ssd: Option, + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, + #[serde(rename = "gpuInstanceProfile", default, skip_serializing_if = "Option::is_none")] + pub gpu_instance_profile: Option, + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAutoUpgradeProfile { + #[serde(rename = "upgradeChannel", default, skip_serializing_if = "Option::is_none")] + pub upgrade_channel: Option, +} +pub mod managed_cluster_auto_upgrade_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpgradeChannel { + #[serde(rename = "rapid")] + Rapid, + #[serde(rename = "stable")] + Stable, + #[serde(rename = "patch")] + Patch, + #[serde(rename = "node-image")] + NodeImage, + #[serde(rename = "none")] + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterHttpProxyConfig { + #[serde(rename = "httpProxy", default, skip_serializing_if = "Option::is_none")] + pub http_proxy: Option, + #[serde(rename = "httpsProxy", default, skip_serializing_if = "Option::is_none")] + pub https_proxy: Option, + #[serde(rename = "noProxy", default, skip_serializing_if = "Vec::is_empty")] + pub no_proxy: Vec, + #[serde(rename = "trustedCa", default, skip_serializing_if = "Option::is_none")] + pub trusted_ca: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod managed_cluster_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterLoadBalancerProfile { + #[serde(rename = "managedOutboundIPs", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_i_ps: Option, + #[serde(rename = "outboundIPPrefixes", default, skip_serializing_if = "Option::is_none")] + pub outbound_ip_prefixes: Option, + #[serde(rename = "outboundIPs", default, skip_serializing_if = "Option::is_none")] + pub outbound_i_ps: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "allocatedOutboundPorts", default, skip_serializing_if = "Option::is_none")] + pub allocated_outbound_ports: Option, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[serde(rename = "enableMultipleStandardLoadBalancers", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_standard_load_balancers: Option, +} +pub mod managed_cluster_load_balancer_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ManagedOutboundIPs { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "countIPv6", default, skip_serializing_if = "Option::is_none")] + pub count_i_pv6: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIpPrefixes { + #[serde(rename = "publicIPPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIPs { + #[serde(rename = "publicIPs", default, skip_serializing_if = "Vec::is_empty")] + pub public_i_ps: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterManagedOutboundIpProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterNatGatewayProfile { + #[serde(rename = "managedOutboundIPProfile", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_ip_profile: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentity { + pub name: String, + pub namespace: String, + #[serde(rename = "bindingSelector", default, skip_serializing_if = "Option::is_none")] + pub binding_selector: Option, + pub identity: UserAssignedIdentity, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisioningInfo", default, skip_serializing_if = "Option::is_none")] + pub provisioning_info: Option, +} +pub mod managed_cluster_pod_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Assigned, + Updating, + Deleting, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ProvisioningInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityException { + pub name: String, + pub namespace: String, + #[serde(rename = "podLabels")] + pub pod_labels: serde_json::Value, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "allowNetworkPluginKubenet", default, skip_serializing_if = "Option::is_none")] + pub allow_network_plugin_kubenet: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identities: Vec, + #[serde(rename = "userAssignedIdentityExceptions", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identity_exceptions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProvisioningError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProvisioningErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPoolUpgradeProfile { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "maxAgentPools", default, skip_serializing_if = "Option::is_none")] + pub max_agent_pools: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "dnsPrefix", default, skip_serializing_if = "Option::is_none")] + pub dns_prefix: Option, + #[serde(rename = "fqdnSubdomain", default, skip_serializing_if = "Option::is_none")] + pub fqdn_subdomain: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "privateFQDN", default, skip_serializing_if = "Option::is_none")] + pub private_fqdn: Option, + #[serde(rename = "azurePortalFQDN", default, skip_serializing_if = "Option::is_none")] + pub azure_portal_fqdn: Option, + #[serde(rename = "agentPoolProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_profiles: Vec, + #[serde(rename = "linuxProfile", default, skip_serializing_if = "Option::is_none")] + pub linux_profile: Option, + #[serde(rename = "windowsProfile", default, skip_serializing_if = "Option::is_none")] + pub windows_profile: Option, + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[serde(rename = "addonProfiles", default, skip_serializing_if = "Option::is_none")] + pub addon_profiles: Option, + #[serde(rename = "podIdentityProfile", default, skip_serializing_if = "Option::is_none")] + pub pod_identity_profile: Option, + #[serde(rename = "nodeResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub node_resource_group: Option, + #[serde(rename = "enableRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_rbac: Option, + #[serde(rename = "enablePodSecurityPolicy", default, skip_serializing_if = "Option::is_none")] + pub enable_pod_security_policy: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "aadProfile", default, skip_serializing_if = "Option::is_none")] + pub aad_profile: Option, + #[serde(rename = "autoUpgradeProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_profile: Option, + #[serde(rename = "autoScalerProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_scaler_profile: Option, + #[serde(rename = "apiServerAccessProfile", default, skip_serializing_if = "Option::is_none")] + pub api_server_access_profile: Option, + #[serde(rename = "diskEncryptionSetID", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "identityProfile", default, skip_serializing_if = "Option::is_none")] + pub identity_profile: Option, + #[serde(rename = "privateLinkResources", default, skip_serializing_if = "Vec::is_empty")] + pub private_link_resources: Vec, + #[serde(rename = "disableLocalAccounts", default, skip_serializing_if = "Option::is_none")] + pub disable_local_accounts: Option, + #[serde(rename = "httpProxyConfig", default, skip_serializing_if = "Option::is_none")] + pub http_proxy_config: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +pub mod managed_cluster_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct AutoScalerProfile { + #[serde(rename = "balance-similar-node-groups", default, skip_serializing_if = "Option::is_none")] + pub balance_similar_node_groups: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expander: Option, + #[serde(rename = "max-empty-bulk-delete", default, skip_serializing_if = "Option::is_none")] + pub max_empty_bulk_delete: Option, + #[serde(rename = "max-graceful-termination-sec", default, skip_serializing_if = "Option::is_none")] + pub max_graceful_termination_sec: Option, + #[serde(rename = "max-node-provision-time", default, skip_serializing_if = "Option::is_none")] + pub max_node_provision_time: Option, + #[serde(rename = "max-total-unready-percentage", default, skip_serializing_if = "Option::is_none")] + pub max_total_unready_percentage: Option, + #[serde(rename = "new-pod-scale-up-delay", default, skip_serializing_if = "Option::is_none")] + pub new_pod_scale_up_delay: Option, + #[serde(rename = "ok-total-unready-count", default, skip_serializing_if = "Option::is_none")] + pub ok_total_unready_count: Option, + #[serde(rename = "scan-interval", default, skip_serializing_if = "Option::is_none")] + pub scan_interval: Option, + #[serde(rename = "scale-down-delay-after-add", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_add: Option, + #[serde(rename = "scale-down-delay-after-delete", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_delete: Option, + #[serde(rename = "scale-down-delay-after-failure", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_failure: Option, + #[serde(rename = "scale-down-unneeded-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unneeded_time: Option, + #[serde(rename = "scale-down-unready-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unready_time: Option, + #[serde(rename = "scale-down-utilization-threshold", default, skip_serializing_if = "Option::is_none")] + pub scale_down_utilization_threshold: Option, + #[serde(rename = "skip-nodes-with-local-storage", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_local_storage: Option, + #[serde(rename = "skip-nodes-with-system-pods", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_system_pods: Option, + } + pub mod auto_scaler_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Expander { + #[serde(rename = "least-waste")] + LeastWaste, + #[serde(rename = "most-pods")] + MostPods, + #[serde(rename = "priority")] + Priority, + #[serde(rename = "random")] + Random, + } + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod managed_cluster_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Paid, + Free, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSecurityProfile { + #[serde(rename = "azureDefender", default, skip_serializing_if = "Option::is_none")] + pub azure_defender: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSecurityProfileAzureDefender { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "logAnalyticsWorkspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub log_analytics_workspace_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterServicePrincipalProfile { + #[serde(rename = "clientId")] + pub client_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: ManagedClusterUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfileProperties { + #[serde(rename = "controlPlaneProfile")] + pub control_plane_profile: ManagedClusterPoolUpgradeProfile, + #[serde(rename = "agentPoolProfiles")] + pub agent_pool_profiles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterWindowsProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "enableCSIProxy", default, skip_serializing_if = "Option::is_none")] + pub enable_csi_proxy: Option, + #[serde(rename = "gmsaProfile", default, skip_serializing_if = "Option::is_none")] + pub gmsa_profile: Option, +} +pub mod managed_cluster_windows_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + None, + #[serde(rename = "Windows_Server")] + WindowsServer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsDiskType { + Managed, + Ephemeral, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: OsOptionPropertyList, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProperty { + #[serde(rename = "os-type")] + pub os_type: String, + #[serde(rename = "enable-fips-image")] + pub enable_fips_image: bool, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionPropertyList { + #[serde(rename = "osOptionPropertyList")] + pub os_option_property_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Ossku { + Ubuntu, + #[serde(rename = "CBLMariner")] + CblMariner, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsType { + Linux, + Windows, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValue { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValueDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpointCollection { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +pub mod power_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + Running, + Stopped, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, +} +pub mod private_endpoint_connection_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "privateLinkServiceID", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourcesListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +pub type ProximityPlacementGroupId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandRequest { + pub command: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[serde(rename = "clusterToken", default, skip_serializing_if = "Option::is_none")] + pub cluster_token: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleDownMode { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetEvictionPolicy { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetPriority { + Spot, + Regular, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Snapshot { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotProperties { + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[serde(rename = "snapshotType", default, skip_serializing_if = "Option::is_none")] + pub snapshot_type: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osSku", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SnapshotType { + NodePool, +} +pub type SpotMaxPrice = f64; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SysctlConfig { + #[serde(rename = "netCoreSomaxconn", default, skip_serializing_if = "Option::is_none")] + pub net_core_somaxconn: Option, + #[serde(rename = "netCoreNetdevMaxBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_core_netdev_max_backlog: Option, + #[serde(rename = "netCoreRmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_default: Option, + #[serde(rename = "netCoreRmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_max: Option, + #[serde(rename = "netCoreWmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_default: Option, + #[serde(rename = "netCoreWmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_max: Option, + #[serde(rename = "netCoreOptmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_optmem_max: Option, + #[serde(rename = "netIpv4TcpMaxSynBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_syn_backlog: Option, + #[serde(rename = "netIpv4TcpMaxTwBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_tw_buckets: Option, + #[serde(rename = "netIpv4TcpFinTimeout", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_fin_timeout: Option, + #[serde(rename = "netIpv4TcpKeepaliveTime", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_time: Option, + #[serde(rename = "netIpv4TcpKeepaliveProbes", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_probes: Option, + #[serde(rename = "netIpv4TcpkeepaliveIntvl", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcpkeepalive_intvl: Option, + #[serde(rename = "netIpv4TcpTwReuse", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_tw_reuse: Option, + #[serde(rename = "netIpv4IpLocalPortRange", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_ip_local_port_range: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh1", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh1: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh2", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh2: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh3", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh3: Option, + #[serde(rename = "netNetfilterNfConntrackMax", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_max: Option, + #[serde(rename = "netNetfilterNfConntrackBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_buckets: Option, + #[serde(rename = "fsInotifyMaxUserWatches", default, skip_serializing_if = "Option::is_none")] + pub fs_inotify_max_user_watches: Option, + #[serde(rename = "fsFileMax", default, skip_serializing_if = "Option::is_none")] + pub fs_file_max: Option, + #[serde(rename = "fsAioMaxNr", default, skip_serializing_if = "Option::is_none")] + pub fs_aio_max_nr: Option, + #[serde(rename = "fsNrOpen", default, skip_serializing_if = "Option::is_none")] + pub fs_nr_open: Option, + #[serde(rename = "kernelThreadsMax", default, skip_serializing_if = "Option::is_none")] + pub kernel_threads_max: Option, + #[serde(rename = "vmMaxMapCount", default, skip_serializing_if = "Option::is_none")] + pub vm_max_map_count: Option, + #[serde(rename = "vmSwappiness", default, skip_serializing_if = "Option::is_none")] + pub vm_swappiness: Option, + #[serde(rename = "vmVfsCachePressure", default, skip_serializing_if = "Option::is_none")] + pub vm_vfs_cache_pressure: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagsObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimeInWeek { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[serde(rename = "hourSlots", default, skip_serializing_if = "Vec::is_empty")] + pub hour_slots: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimeSpan { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentity { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WeekDay { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WindowsGmsaProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "dnsServer", default, skip_serializing_if = "Option::is_none")] + pub dns_server: Option, + #[serde(rename = "rootDomainName", default, skip_serializing_if = "Option::is_none")] + pub root_domain_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WorkloadRuntime { + #[serde(rename = "OCIContainer")] + OciContainer, + WasmWasi, +} diff --git a/services/mgmt/containerservice/src/package_2021_10_01_only/operations.rs b/services/mgmt/containerservice/src/package_2021_10_01_only/operations.rs new file mode 100644 index 0000000000..98474a8d81 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_10_01_only/operations.rs @@ -0,0 +1,4265 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn agent_pools(&self) -> agent_pools::Client { + agent_pools::Client(self.clone()) + } + pub fn maintenance_configurations(&self) -> maintenance_configurations::Client { + maintenance_configurations::Client(self.clone()) + } + pub fn managed_clusters(&self) -> managed_clusters::Client { + managed_clusters::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn resolve_private_link_service_id(&self) -> resolve_private_link_service_id::Client { + resolve_private_link_service_id::Client(self.clone()) + } + pub fn snapshots(&self) -> snapshots::Client { + snapshots::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ManagedClusters_GetOsOptions(#[from] managed_clusters::get_os_options::Error), + #[error(transparent)] + ManagedClusters_List(#[from] managed_clusters::list::Error), + #[error(transparent)] + ManagedClusters_ListByResourceGroup(#[from] managed_clusters::list_by_resource_group::Error), + #[error(transparent)] + ManagedClusters_GetUpgradeProfile(#[from] managed_clusters::get_upgrade_profile::Error), + #[error(transparent)] + ManagedClusters_GetAccessProfile(#[from] managed_clusters::get_access_profile::Error), + #[error(transparent)] + ManagedClusters_ListClusterAdminCredentials(#[from] managed_clusters::list_cluster_admin_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterUserCredentials(#[from] managed_clusters::list_cluster_user_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterMonitoringUserCredentials(#[from] managed_clusters::list_cluster_monitoring_user_credentials::Error), + #[error(transparent)] + ManagedClusters_Get(#[from] managed_clusters::get::Error), + #[error(transparent)] + ManagedClusters_CreateOrUpdate(#[from] managed_clusters::create_or_update::Error), + #[error(transparent)] + ManagedClusters_UpdateTags(#[from] managed_clusters::update_tags::Error), + #[error(transparent)] + ManagedClusters_Delete(#[from] managed_clusters::delete::Error), + #[error(transparent)] + MaintenanceConfigurations_ListByManagedCluster(#[from] maintenance_configurations::list_by_managed_cluster::Error), + #[error(transparent)] + MaintenanceConfigurations_Get(#[from] maintenance_configurations::get::Error), + #[error(transparent)] + MaintenanceConfigurations_CreateOrUpdate(#[from] maintenance_configurations::create_or_update::Error), + #[error(transparent)] + MaintenanceConfigurations_Delete(#[from] maintenance_configurations::delete::Error), + #[error(transparent)] + AgentPools_List(#[from] agent_pools::list::Error), + #[error(transparent)] + AgentPools_Get(#[from] agent_pools::get::Error), + #[error(transparent)] + AgentPools_CreateOrUpdate(#[from] agent_pools::create_or_update::Error), + #[error(transparent)] + AgentPools_Delete(#[from] agent_pools::delete::Error), + #[error(transparent)] + AgentPools_GetUpgradeProfile(#[from] agent_pools::get_upgrade_profile::Error), + #[error(transparent)] + AgentPools_GetAvailableAgentPoolVersions(#[from] agent_pools::get_available_agent_pool_versions::Error), + #[error(transparent)] + ManagedClusters_ResetServicePrincipalProfile(#[from] managed_clusters::reset_service_principal_profile::Error), + #[error(transparent)] + ManagedClusters_ResetAadProfile(#[from] managed_clusters::reset_aad_profile::Error), + #[error(transparent)] + ManagedClusters_RotateClusterCertificates(#[from] managed_clusters::rotate_cluster_certificates::Error), + #[error(transparent)] + ManagedClusters_Stop(#[from] managed_clusters::stop::Error), + #[error(transparent)] + ManagedClusters_Start(#[from] managed_clusters::start::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Update(#[from] private_endpoint_connections::update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + AgentPools_UpgradeNodeImageVersion(#[from] agent_pools::upgrade_node_image_version::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + ResolvePrivateLinkServiceId_Post(#[from] resolve_private_link_service_id::post::Error), + #[error(transparent)] + ManagedClusters_RunCommand(#[from] managed_clusters::run_command::Error), + #[error(transparent)] + ManagedClusters_GetCommandResult(#[from] managed_clusters::get_command_result::Error), + #[error(transparent)] + ManagedClusters_ListOutboundNetworkDependenciesEndpoints(#[from] managed_clusters::list_outbound_network_dependencies_endpoints::Error), + #[error(transparent)] + Snapshots_List(#[from] snapshots::list::Error), + #[error(transparent)] + Snapshots_ListByResourceGroup(#[from] snapshots::list_by_resource_group::Error), + #[error(transparent)] + Snapshots_Get(#[from] snapshots::get::Error), + #[error(transparent)] + Snapshots_CreateOrUpdate(#[from] snapshots::create_or_update::Error), + #[error(transparent)] + Snapshots_UpdateTags(#[from] snapshots::update_tags::Error), + #[error(transparent)] + Snapshots_Delete(#[from] snapshots::delete::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of operations."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_clusters { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets supported OS options in the specified subscription."] + pub fn get_os_options(&self, subscription_id: impl Into, location: impl Into) -> get_os_options::Builder { + get_os_options::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + resource_type: None, + } + } + #[doc = "Gets a list of managed clusters in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists managed clusters in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets the upgrade profile of a managed cluster."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets an access profile of a managed cluster."] + pub fn get_access_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + role_name: impl Into, + ) -> get_access_profile::Builder { + get_access_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + role_name: role_name.into(), + } + } + #[doc = "Lists the admin credentials of a managed cluster."] + pub fn list_cluster_admin_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_admin_credentials::Builder { + list_cluster_admin_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the user credentials of a managed cluster."] + pub fn list_cluster_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_user_credentials::Builder { + list_cluster_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the cluster monitoring user credentials of a managed cluster."] + pub fn list_cluster_monitoring_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_monitoring_user_credentials::Builder { + list_cluster_monitoring_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Gets a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a managed cluster."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Reset the Service Principal Profile of a managed cluster."] + pub fn reset_service_principal_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_service_principal_profile::Builder { + reset_service_principal_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Reset the AAD Profile of a managed cluster."] + pub fn reset_aad_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_aad_profile::Builder { + reset_aad_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Rotates the certificates of a managed cluster."] + pub fn rotate_cluster_certificates( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> rotate_cluster_certificates::Builder { + rotate_cluster_certificates::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Stops a Managed Cluster"] + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Starts a previously stopped Managed Cluster"] + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Submits a command to run against the Managed Cluster."] + pub fn run_command( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + request_payload: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + request_payload: request_payload.into(), + } + } + #[doc = "Gets the results of a command which has been run on the Managed Cluster."] + pub fn get_command_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + command_id: impl Into, + ) -> get_command_result::Builder { + get_command_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + command_id: command_id.into(), + } + } + #[doc = "Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster."] + pub fn list_outbound_network_dependencies_endpoints( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_outbound_network_dependencies_endpoints::Builder { + list_outbound_network_dependencies_endpoints::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod get_os_options { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) resource_type: Option, + } + impl Builder { + pub fn resource_type(mut self, resource_type: impl Into) -> Self { + self.resource_type = Some(resource_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/locations/{}/osOptions/default", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(resource_type) = &self.resource_type { + url.query_pairs_mut().append_pair("resource-type", resource_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsOptionProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_access_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) role_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/accessProfiles/{}/listCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterAccessProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_admin_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterAdminCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_monitoring_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterMonitoringUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedCluster), + Created201(models::ManagedCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedCluster, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_service_principal_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterServicePrincipalProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetServicePrincipalProfile" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_aad_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterAadProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetAADProfile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rotate_cluster_certificates { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/rotateClusterCertificates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) request_payload: models::RunCommandRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/runCommand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_command_result { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) command_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/commandResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.command_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_outbound_network_dependencies_endpoints { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundEnvironmentEndpointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod maintenance_configurations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of maintenance configurations in the specified managed cluster."] + pub fn list_by_managed_cluster( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_by_managed_cluster::Builder { + list_by_managed_cluster::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified maintenance configuration of a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + #[doc = "Creates or updates a maintenance configuration in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a maintenance configuration."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + } + pub mod list_by_managed_cluster { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + pub(crate) parameters: models::MaintenanceConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod agent_pools { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of agent pools in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified managed cluster agent pool."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Creates or updates an agent pool in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes an agent pool in the specified managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets the upgrade profile for an agent pool."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets a list of supported Kubernetes versions for the specified agent pool."] + pub fn get_available_agent_pool_versions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_available_agent_pool_versions::Builder { + get_available_agent_pool_versions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Upgrades the node image version of an agent pool to the latest."] + pub fn upgrade_node_image_version( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> upgrade_node_image_version::Builder { + upgrade_node_image_version::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + pub(crate) parameters: models::AgentPool, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_available_agent_pool_versions { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/availableAgentPoolVersions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolAvailableVersions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod upgrade_node_image_version { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeNodeImageVersion" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private endpoint connections in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified private endpoint connection."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + #[doc = "Updates a private endpoint connection."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a private endpoint connection."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private link resources in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateLinkResources" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resolve_private_link_service_id { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the private link service ID for the specified managed cluster."] + pub fn post( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> post::Builder { + post::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + } + pub mod post { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::PrivateLinkResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resolvePrivateLinkServiceId" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod snapshots { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of snapshots in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists snapshots in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a snapshot."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a snapshot."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a snapshot."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a snapshot."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Created201(models::Snapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::Snapshot, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/containerservice/src/package_2021_11_01_preview_only/mod.rs b/services/mgmt/containerservice/src/package_2021_11_01_preview_only/mod.rs new file mode 100644 index 0000000000..75f67dfde9 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_11_01_preview_only/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-11-01-preview"; diff --git a/services/mgmt/containerservice/src/package_2021_11_01_preview_only/models.rs b/services/mgmt/containerservice/src/package_2021_11_01_preview_only/models.rs new file mode 100644 index 0000000000..f48164fee4 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_11_01_preview_only/models.rs @@ -0,0 +1,1663 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccessProfile { + #[serde(rename = "kubeConfig", default, skip_serializing_if = "Option::is_none")] + pub kube_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolAvailableVersionsProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersionsProperties { + #[serde(rename = "agentPoolVersions", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_versions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolMode { + System, + User, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolType { + VirtualMachineScaleSets, + AvailabilitySet, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfileProperties { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, + #[serde(rename = "latestNodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_node_image_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeSettings { + #[serde(rename = "maxSurge", default, skip_serializing_if = "Option::is_none")] + pub max_surge: Option, +} +pub type CapacityReservationGroupId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommandResultProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "exitCode", default, skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + #[serde(rename = "startedAt", default, skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[serde(rename = "finishedAt", default, skip_serializing_if = "Option::is_none")] + pub finished_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub logs: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceDiagnosticsProfile { + #[serde(rename = "vmDiagnostics")] + pub vm_diagnostics: ContainerServiceVmDiagnostics, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceLinuxProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + pub ssh: ContainerServiceSshConfiguration, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceMasterProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "dnsPrefix")] + pub dns_prefix: String, + #[serde(rename = "vmSize")] + pub vm_size: ContainerServiceVmSize, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "firstConsecutiveStaticIP", default, skip_serializing_if = "Option::is_none")] + pub first_consecutive_static_ip: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, +} +pub mod container_service_master_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Count {} +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceNetworkProfile { + #[serde(rename = "networkPlugin", default, skip_serializing_if = "Option::is_none")] + pub network_plugin: Option, + #[serde(rename = "networkPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_policy: Option, + #[serde(rename = "networkMode", default, skip_serializing_if = "Option::is_none")] + pub network_mode: Option, + #[serde(rename = "podCidr", default, skip_serializing_if = "Option::is_none")] + pub pod_cidr: Option, + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, + #[serde(rename = "dnsServiceIP", default, skip_serializing_if = "Option::is_none")] + pub dns_service_ip: Option, + #[serde(rename = "dockerBridgeCidr", default, skip_serializing_if = "Option::is_none")] + pub docker_bridge_cidr: Option, + #[serde(rename = "outboundType", default, skip_serializing_if = "Option::is_none")] + pub outbound_type: Option, + #[serde(rename = "loadBalancerSku", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_sku: Option, + #[serde(rename = "loadBalancerProfile", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_profile: Option, + #[serde(rename = "natGatewayProfile", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway_profile: Option, + #[serde(rename = "podCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub pod_cidrs: Vec, + #[serde(rename = "serviceCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub service_cidrs: Vec, + #[serde(rename = "ipFamilies", default, skip_serializing_if = "Vec::is_empty")] + pub ip_families: Vec, +} +pub mod container_service_network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPlugin { + #[serde(rename = "azure")] + Azure, + #[serde(rename = "kubenet")] + Kubenet, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPolicy { + #[serde(rename = "calico")] + Calico, + #[serde(rename = "azure")] + Azure, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkMode { + #[serde(rename = "transparent")] + Transparent, + #[serde(rename = "bridge")] + Bridge, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OutboundType { + #[serde(rename = "loadBalancer")] + LoadBalancer, + #[serde(rename = "userDefinedRouting")] + UserDefinedRouting, + #[serde(rename = "managedNATGateway")] + ManagedNatGateway, + #[serde(rename = "userAssignedNATGateway")] + UserAssignedNatGateway, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoadBalancerSku { + #[serde(rename = "standard")] + Standard, + #[serde(rename = "basic")] + Basic, + } +} +pub type ContainerServiceOsDisk = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshConfiguration { + #[serde(rename = "publicKeys")] + pub public_keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshPublicKey { + #[serde(rename = "keyData")] + pub key_data: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceStorageProfile { + StorageAccount, + ManagedDisks, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceVmDiagnostics { + pub enabled: bool, + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceVmSize { + #[serde(rename = "Standard_A1")] + StandardA1, + #[serde(rename = "Standard_A10")] + StandardA10, + #[serde(rename = "Standard_A11")] + StandardA11, + #[serde(rename = "Standard_A1_v2")] + StandardA1V2, + #[serde(rename = "Standard_A2")] + StandardA2, + #[serde(rename = "Standard_A2_v2")] + StandardA2V2, + #[serde(rename = "Standard_A2m_v2")] + StandardA2mV2, + #[serde(rename = "Standard_A3")] + StandardA3, + #[serde(rename = "Standard_A4")] + StandardA4, + #[serde(rename = "Standard_A4_v2")] + StandardA4V2, + #[serde(rename = "Standard_A4m_v2")] + StandardA4mV2, + #[serde(rename = "Standard_A5")] + StandardA5, + #[serde(rename = "Standard_A6")] + StandardA6, + #[serde(rename = "Standard_A7")] + StandardA7, + #[serde(rename = "Standard_A8")] + StandardA8, + #[serde(rename = "Standard_A8_v2")] + StandardA8V2, + #[serde(rename = "Standard_A8m_v2")] + StandardA8mV2, + #[serde(rename = "Standard_A9")] + StandardA9, + #[serde(rename = "Standard_B2ms")] + StandardB2ms, + #[serde(rename = "Standard_B2s")] + StandardB2s, + #[serde(rename = "Standard_B4ms")] + StandardB4ms, + #[serde(rename = "Standard_B8ms")] + StandardB8ms, + #[serde(rename = "Standard_D1")] + StandardD1, + #[serde(rename = "Standard_D11")] + StandardD11, + #[serde(rename = "Standard_D11_v2")] + StandardD11V2, + #[serde(rename = "Standard_D11_v2_Promo")] + StandardD11V2Promo, + #[serde(rename = "Standard_D12")] + StandardD12, + #[serde(rename = "Standard_D12_v2")] + StandardD12V2, + #[serde(rename = "Standard_D12_v2_Promo")] + StandardD12V2Promo, + #[serde(rename = "Standard_D13")] + StandardD13, + #[serde(rename = "Standard_D13_v2")] + StandardD13V2, + #[serde(rename = "Standard_D13_v2_Promo")] + StandardD13V2Promo, + #[serde(rename = "Standard_D14")] + StandardD14, + #[serde(rename = "Standard_D14_v2")] + StandardD14V2, + #[serde(rename = "Standard_D14_v2_Promo")] + StandardD14V2Promo, + #[serde(rename = "Standard_D15_v2")] + StandardD15V2, + #[serde(rename = "Standard_D16_v3")] + StandardD16V3, + #[serde(rename = "Standard_D16s_v3")] + StandardD16sV3, + #[serde(rename = "Standard_D1_v2")] + StandardD1V2, + #[serde(rename = "Standard_D2")] + StandardD2, + #[serde(rename = "Standard_D2_v2")] + StandardD2V2, + #[serde(rename = "Standard_D2_v2_Promo")] + StandardD2V2Promo, + #[serde(rename = "Standard_D2_v3")] + StandardD2V3, + #[serde(rename = "Standard_D2s_v3")] + StandardD2sV3, + #[serde(rename = "Standard_D3")] + StandardD3, + #[serde(rename = "Standard_D32_v3")] + StandardD32V3, + #[serde(rename = "Standard_D32s_v3")] + StandardD32sV3, + #[serde(rename = "Standard_D3_v2")] + StandardD3V2, + #[serde(rename = "Standard_D3_v2_Promo")] + StandardD3V2Promo, + #[serde(rename = "Standard_D4")] + StandardD4, + #[serde(rename = "Standard_D4_v2")] + StandardD4V2, + #[serde(rename = "Standard_D4_v2_Promo")] + StandardD4V2Promo, + #[serde(rename = "Standard_D4_v3")] + StandardD4V3, + #[serde(rename = "Standard_D4s_v3")] + StandardD4sV3, + #[serde(rename = "Standard_D5_v2")] + StandardD5V2, + #[serde(rename = "Standard_D5_v2_Promo")] + StandardD5V2Promo, + #[serde(rename = "Standard_D64_v3")] + StandardD64V3, + #[serde(rename = "Standard_D64s_v3")] + StandardD64sV3, + #[serde(rename = "Standard_D8_v3")] + StandardD8V3, + #[serde(rename = "Standard_D8s_v3")] + StandardD8sV3, + #[serde(rename = "Standard_DS1")] + StandardDs1, + #[serde(rename = "Standard_DS11")] + StandardDs11, + #[serde(rename = "Standard_DS11_v2")] + StandardDs11V2, + #[serde(rename = "Standard_DS11_v2_Promo")] + StandardDs11V2Promo, + #[serde(rename = "Standard_DS12")] + StandardDs12, + #[serde(rename = "Standard_DS12_v2")] + StandardDs12V2, + #[serde(rename = "Standard_DS12_v2_Promo")] + StandardDs12V2Promo, + #[serde(rename = "Standard_DS13")] + StandardDs13, + #[serde(rename = "Standard_DS13-2_v2")] + StandardDs132V2, + #[serde(rename = "Standard_DS13-4_v2")] + StandardDs134V2, + #[serde(rename = "Standard_DS13_v2")] + StandardDs13V2, + #[serde(rename = "Standard_DS13_v2_Promo")] + StandardDs13V2Promo, + #[serde(rename = "Standard_DS14")] + StandardDs14, + #[serde(rename = "Standard_DS14-4_v2")] + StandardDs144V2, + #[serde(rename = "Standard_DS14-8_v2")] + StandardDs148V2, + #[serde(rename = "Standard_DS14_v2")] + StandardDs14V2, + #[serde(rename = "Standard_DS14_v2_Promo")] + StandardDs14V2Promo, + #[serde(rename = "Standard_DS15_v2")] + StandardDs15V2, + #[serde(rename = "Standard_DS1_v2")] + StandardDs1V2, + #[serde(rename = "Standard_DS2")] + StandardDs2, + #[serde(rename = "Standard_DS2_v2")] + StandardDs2V2, + #[serde(rename = "Standard_DS2_v2_Promo")] + StandardDs2V2Promo, + #[serde(rename = "Standard_DS3")] + StandardDs3, + #[serde(rename = "Standard_DS3_v2")] + StandardDs3V2, + #[serde(rename = "Standard_DS3_v2_Promo")] + StandardDs3V2Promo, + #[serde(rename = "Standard_DS4")] + StandardDs4, + #[serde(rename = "Standard_DS4_v2")] + StandardDs4V2, + #[serde(rename = "Standard_DS4_v2_Promo")] + StandardDs4V2Promo, + #[serde(rename = "Standard_DS5_v2")] + StandardDs5V2, + #[serde(rename = "Standard_DS5_v2_Promo")] + StandardDs5V2Promo, + #[serde(rename = "Standard_E16_v3")] + StandardE16V3, + #[serde(rename = "Standard_E16s_v3")] + StandardE16sV3, + #[serde(rename = "Standard_E2_v3")] + StandardE2V3, + #[serde(rename = "Standard_E2s_v3")] + StandardE2sV3, + #[serde(rename = "Standard_E32-16s_v3")] + StandardE3216sV3, + #[serde(rename = "Standard_E32-8s_v3")] + StandardE328sV3, + #[serde(rename = "Standard_E32_v3")] + StandardE32V3, + #[serde(rename = "Standard_E32s_v3")] + StandardE32sV3, + #[serde(rename = "Standard_E4_v3")] + StandardE4V3, + #[serde(rename = "Standard_E4s_v3")] + StandardE4sV3, + #[serde(rename = "Standard_E64-16s_v3")] + StandardE6416sV3, + #[serde(rename = "Standard_E64-32s_v3")] + StandardE6432sV3, + #[serde(rename = "Standard_E64_v3")] + StandardE64V3, + #[serde(rename = "Standard_E64s_v3")] + StandardE64sV3, + #[serde(rename = "Standard_E8_v3")] + StandardE8V3, + #[serde(rename = "Standard_E8s_v3")] + StandardE8sV3, + #[serde(rename = "Standard_F1")] + StandardF1, + #[serde(rename = "Standard_F16")] + StandardF16, + #[serde(rename = "Standard_F16s")] + StandardF16s, + #[serde(rename = "Standard_F16s_v2")] + StandardF16sV2, + #[serde(rename = "Standard_F1s")] + StandardF1s, + #[serde(rename = "Standard_F2")] + StandardF2, + #[serde(rename = "Standard_F2s")] + StandardF2s, + #[serde(rename = "Standard_F2s_v2")] + StandardF2sV2, + #[serde(rename = "Standard_F32s_v2")] + StandardF32sV2, + #[serde(rename = "Standard_F4")] + StandardF4, + #[serde(rename = "Standard_F4s")] + StandardF4s, + #[serde(rename = "Standard_F4s_v2")] + StandardF4sV2, + #[serde(rename = "Standard_F64s_v2")] + StandardF64sV2, + #[serde(rename = "Standard_F72s_v2")] + StandardF72sV2, + #[serde(rename = "Standard_F8")] + StandardF8, + #[serde(rename = "Standard_F8s")] + StandardF8s, + #[serde(rename = "Standard_F8s_v2")] + StandardF8sV2, + #[serde(rename = "Standard_G1")] + StandardG1, + #[serde(rename = "Standard_G2")] + StandardG2, + #[serde(rename = "Standard_G3")] + StandardG3, + #[serde(rename = "Standard_G4")] + StandardG4, + #[serde(rename = "Standard_G5")] + StandardG5, + #[serde(rename = "Standard_GS1")] + StandardGs1, + #[serde(rename = "Standard_GS2")] + StandardGs2, + #[serde(rename = "Standard_GS3")] + StandardGs3, + #[serde(rename = "Standard_GS4")] + StandardGs4, + #[serde(rename = "Standard_GS4-4")] + StandardGs44, + #[serde(rename = "Standard_GS4-8")] + StandardGs48, + #[serde(rename = "Standard_GS5")] + StandardGs5, + #[serde(rename = "Standard_GS5-16")] + StandardGs516, + #[serde(rename = "Standard_GS5-8")] + StandardGs58, + #[serde(rename = "Standard_H16")] + StandardH16, + #[serde(rename = "Standard_H16m")] + StandardH16m, + #[serde(rename = "Standard_H16mr")] + StandardH16mr, + #[serde(rename = "Standard_H16r")] + StandardH16r, + #[serde(rename = "Standard_H8")] + StandardH8, + #[serde(rename = "Standard_H8m")] + StandardH8m, + #[serde(rename = "Standard_L16s")] + StandardL16s, + #[serde(rename = "Standard_L32s")] + StandardL32s, + #[serde(rename = "Standard_L4s")] + StandardL4s, + #[serde(rename = "Standard_L8s")] + StandardL8s, + #[serde(rename = "Standard_M128-32ms")] + StandardM12832ms, + #[serde(rename = "Standard_M128-64ms")] + StandardM12864ms, + #[serde(rename = "Standard_M128ms")] + StandardM128ms, + #[serde(rename = "Standard_M128s")] + StandardM128s, + #[serde(rename = "Standard_M64-16ms")] + StandardM6416ms, + #[serde(rename = "Standard_M64-32ms")] + StandardM6432ms, + #[serde(rename = "Standard_M64ms")] + StandardM64ms, + #[serde(rename = "Standard_M64s")] + StandardM64s, + #[serde(rename = "Standard_NC12")] + StandardNc12, + #[serde(rename = "Standard_NC12s_v2")] + StandardNc12sV2, + #[serde(rename = "Standard_NC12s_v3")] + StandardNc12sV3, + #[serde(rename = "Standard_NC24")] + StandardNc24, + #[serde(rename = "Standard_NC24r")] + StandardNc24r, + #[serde(rename = "Standard_NC24rs_v2")] + StandardNc24rsV2, + #[serde(rename = "Standard_NC24rs_v3")] + StandardNc24rsV3, + #[serde(rename = "Standard_NC24s_v2")] + StandardNc24sV2, + #[serde(rename = "Standard_NC24s_v3")] + StandardNc24sV3, + #[serde(rename = "Standard_NC6")] + StandardNc6, + #[serde(rename = "Standard_NC6s_v2")] + StandardNc6sV2, + #[serde(rename = "Standard_NC6s_v3")] + StandardNc6sV3, + #[serde(rename = "Standard_ND12s")] + StandardNd12s, + #[serde(rename = "Standard_ND24rs")] + StandardNd24rs, + #[serde(rename = "Standard_ND24s")] + StandardNd24s, + #[serde(rename = "Standard_ND6s")] + StandardNd6s, + #[serde(rename = "Standard_NV12")] + StandardNv12, + #[serde(rename = "Standard_NV24")] + StandardNv24, + #[serde(rename = "Standard_NV6")] + StandardNv6, +} +pub type ContainerServiceVnetSubnetId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreationData { + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResults { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub kubeconfigs: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointDependency { + #[serde(rename = "domainName", default, skip_serializing_if = "Option::is_none")] + pub domain_name: Option, + #[serde(rename = "endpointDetails", default, skip_serializing_if = "Vec::is_empty")] + pub endpoint_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointDetail { + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExtendedLocationType { + EdgeZone, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum GpuInstanceProfile { + #[serde(rename = "MIG1g")] + Mig1g, + #[serde(rename = "MIG2g")] + Mig2g, + #[serde(rename = "MIG3g")] + Mig3g, + #[serde(rename = "MIG4g")] + Mig4g, + #[serde(rename = "MIG7g")] + Mig7g, +} +pub type HourInDay = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubeletConfig { + #[serde(rename = "cpuManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub cpu_manager_policy: Option, + #[serde(rename = "cpuCfsQuota", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota: Option, + #[serde(rename = "cpuCfsQuotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota_period: Option, + #[serde(rename = "imageGcHighThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_high_threshold: Option, + #[serde(rename = "imageGcLowThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_low_threshold: Option, + #[serde(rename = "topologyManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub topology_manager_policy: Option, + #[serde(rename = "allowedUnsafeSysctls", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_unsafe_sysctls: Vec, + #[serde(rename = "failSwapOn", default, skip_serializing_if = "Option::is_none")] + pub fail_swap_on: Option, + #[serde(rename = "containerLogMaxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_size_mb: Option, + #[serde(rename = "containerLogMaxFiles", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_files: Option, + #[serde(rename = "podMaxPids", default, skip_serializing_if = "Option::is_none")] + pub pod_max_pids: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KubeletDiskType { + #[serde(rename = "OS")] + Os, + Temporary, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinuxOsConfig { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sysctls: Option, + #[serde(rename = "transparentHugePageEnabled", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_enabled: Option, + #[serde(rename = "transparentHugePageDefrag", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_defrag: Option, + #[serde(rename = "swapFileSizeMB", default, skip_serializing_if = "Option::is_none")] + pub swap_file_size_mb: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfigurationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfigurationProperties { + #[serde(rename = "timeInWeek", default, skip_serializing_if = "Vec::is_empty")] + pub time_in_week: Vec, + #[serde(rename = "notAllowedTime", default, skip_serializing_if = "Vec::is_empty")] + pub not_allowed_time: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCluster { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAadProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub managed: Option, + #[serde(rename = "enableAzureRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_azure_rbac: Option, + #[serde(rename = "adminGroupObjectIDs", default, skip_serializing_if = "Vec::is_empty")] + pub admin_group_object_i_ds: Vec, + #[serde(rename = "clientAppID", default, skip_serializing_if = "Option::is_none")] + pub client_app_id: Option, + #[serde(rename = "serverAppID", default, skip_serializing_if = "Option::is_none")] + pub server_app_id: Option, + #[serde(rename = "serverAppSecret", default, skip_serializing_if = "Option::is_none")] + pub server_app_secret: Option, + #[serde(rename = "tenantID", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterApiServerAccessProfile { + #[serde(rename = "authorizedIPRanges", default, skip_serializing_if = "Vec::is_empty")] + pub authorized_ip_ranges: Vec, + #[serde(rename = "enablePrivateCluster", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster: Option, + #[serde(rename = "privateDNSZone", default, skip_serializing_if = "Option::is_none")] + pub private_dns_zone: Option, + #[serde(rename = "enablePrivateClusterPublicFQDN", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster_public_fqdn: Option, + #[serde(rename = "disableRunCommand", default, skip_serializing_if = "Option::is_none")] + pub disable_run_command: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAccessProfile { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAddonProfile { + pub enabled: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub config: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfile { + #[serde(flatten)] + pub managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties, + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfileProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "osDiskType", default, skip_serializing_if = "Option::is_none")] + pub os_disk_type: Option, + #[serde(rename = "kubeletDiskType", default, skip_serializing_if = "Option::is_none")] + pub kubelet_disk_type: Option, + #[serde(rename = "workloadRuntime", default, skip_serializing_if = "Option::is_none")] + pub workload_runtime: Option, + #[serde(rename = "messageOfTheDay", default, skip_serializing_if = "Option::is_none")] + pub message_of_the_day: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "podSubnetID", default, skip_serializing_if = "Option::is_none")] + pub pod_subnet_id: Option, + #[serde(rename = "maxPods", default, skip_serializing_if = "Option::is_none")] + pub max_pods: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osSKU", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[serde(rename = "maxCount", default, skip_serializing_if = "Option::is_none")] + pub max_count: Option, + #[serde(rename = "minCount", default, skip_serializing_if = "Option::is_none")] + pub min_count: Option, + #[serde(rename = "enableAutoScaling", default, skip_serializing_if = "Option::is_none")] + pub enable_auto_scaling: Option, + #[serde(rename = "scaleDownMode", default, skip_serializing_if = "Option::is_none")] + pub scale_down_mode: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "orchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "upgradeSettings", default, skip_serializing_if = "Option::is_none")] + pub upgrade_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "availabilityZones", default, skip_serializing_if = "Vec::is_empty")] + pub availability_zones: Vec, + #[serde(rename = "enableNodePublicIP", default, skip_serializing_if = "Option::is_none")] + pub enable_node_public_ip: Option, + #[serde(rename = "nodePublicIPPrefixID", default, skip_serializing_if = "Option::is_none")] + pub node_public_ip_prefix_id: Option, + #[serde(rename = "scaleSetPriority", default, skip_serializing_if = "Option::is_none")] + pub scale_set_priority: Option, + #[serde(rename = "scaleSetEvictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_set_eviction_policy: Option, + #[serde(rename = "spotMaxPrice", default, skip_serializing_if = "Option::is_none")] + pub spot_max_price: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "nodeLabels", default, skip_serializing_if = "Option::is_none")] + pub node_labels: Option, + #[serde(rename = "nodeTaints", default, skip_serializing_if = "Vec::is_empty")] + pub node_taints: Vec, + #[serde(rename = "proximityPlacementGroupID", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group_id: Option, + #[serde(rename = "kubeletConfig", default, skip_serializing_if = "Option::is_none")] + pub kubelet_config: Option, + #[serde(rename = "linuxOSConfig", default, skip_serializing_if = "Option::is_none")] + pub linux_os_config: Option, + #[serde(rename = "enableEncryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub enable_encryption_at_host: Option, + #[serde(rename = "enableUltraSSD", default, skip_serializing_if = "Option::is_none")] + pub enable_ultra_ssd: Option, + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, + #[serde(rename = "gpuInstanceProfile", default, skip_serializing_if = "Option::is_none")] + pub gpu_instance_profile: Option, + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[serde(rename = "capacityReservationGroupID", default, skip_serializing_if = "Option::is_none")] + pub capacity_reservation_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAutoUpgradeProfile { + #[serde(rename = "upgradeChannel", default, skip_serializing_if = "Option::is_none")] + pub upgrade_channel: Option, +} +pub mod managed_cluster_auto_upgrade_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpgradeChannel { + #[serde(rename = "rapid")] + Rapid, + #[serde(rename = "stable")] + Stable, + #[serde(rename = "patch")] + Patch, + #[serde(rename = "node-image")] + NodeImage, + #[serde(rename = "none")] + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterHttpProxyConfig { + #[serde(rename = "httpProxy", default, skip_serializing_if = "Option::is_none")] + pub http_proxy: Option, + #[serde(rename = "httpsProxy", default, skip_serializing_if = "Option::is_none")] + pub https_proxy: Option, + #[serde(rename = "noProxy", default, skip_serializing_if = "Vec::is_empty")] + pub no_proxy: Vec, + #[serde(rename = "trustedCa", default, skip_serializing_if = "Option::is_none")] + pub trusted_ca: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod managed_cluster_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterLoadBalancerProfile { + #[serde(rename = "managedOutboundIPs", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_i_ps: Option, + #[serde(rename = "outboundIPPrefixes", default, skip_serializing_if = "Option::is_none")] + pub outbound_ip_prefixes: Option, + #[serde(rename = "outboundIPs", default, skip_serializing_if = "Option::is_none")] + pub outbound_i_ps: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "allocatedOutboundPorts", default, skip_serializing_if = "Option::is_none")] + pub allocated_outbound_ports: Option, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[serde(rename = "enableMultipleStandardLoadBalancers", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_standard_load_balancers: Option, +} +pub mod managed_cluster_load_balancer_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ManagedOutboundIPs { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "countIPv6", default, skip_serializing_if = "Option::is_none")] + pub count_i_pv6: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIpPrefixes { + #[serde(rename = "publicIPPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIPs { + #[serde(rename = "publicIPs", default, skip_serializing_if = "Vec::is_empty")] + pub public_i_ps: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterManagedOutboundIpProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterNatGatewayProfile { + #[serde(rename = "managedOutboundIPProfile", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_ip_profile: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterOidcIssuerProfile { + #[serde(rename = "issuerURL", default, skip_serializing_if = "Option::is_none")] + pub issuer_url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentity { + pub name: String, + pub namespace: String, + #[serde(rename = "bindingSelector", default, skip_serializing_if = "Option::is_none")] + pub binding_selector: Option, + pub identity: UserAssignedIdentity, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisioningInfo", default, skip_serializing_if = "Option::is_none")] + pub provisioning_info: Option, +} +pub mod managed_cluster_pod_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Assigned, + Updating, + Deleting, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ProvisioningInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityException { + pub name: String, + pub namespace: String, + #[serde(rename = "podLabels")] + pub pod_labels: serde_json::Value, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "allowNetworkPluginKubenet", default, skip_serializing_if = "Option::is_none")] + pub allow_network_plugin_kubenet: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identities: Vec, + #[serde(rename = "userAssignedIdentityExceptions", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identity_exceptions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProvisioningError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProvisioningErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPoolUpgradeProfile { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "maxAgentPools", default, skip_serializing_if = "Option::is_none")] + pub max_agent_pools: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "currentKubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub current_kubernetes_version: Option, + #[serde(rename = "dnsPrefix", default, skip_serializing_if = "Option::is_none")] + pub dns_prefix: Option, + #[serde(rename = "fqdnSubdomain", default, skip_serializing_if = "Option::is_none")] + pub fqdn_subdomain: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "privateFQDN", default, skip_serializing_if = "Option::is_none")] + pub private_fqdn: Option, + #[serde(rename = "azurePortalFQDN", default, skip_serializing_if = "Option::is_none")] + pub azure_portal_fqdn: Option, + #[serde(rename = "agentPoolProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_profiles: Vec, + #[serde(rename = "linuxProfile", default, skip_serializing_if = "Option::is_none")] + pub linux_profile: Option, + #[serde(rename = "windowsProfile", default, skip_serializing_if = "Option::is_none")] + pub windows_profile: Option, + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[serde(rename = "addonProfiles", default, skip_serializing_if = "Option::is_none")] + pub addon_profiles: Option, + #[serde(rename = "podIdentityProfile", default, skip_serializing_if = "Option::is_none")] + pub pod_identity_profile: Option, + #[serde(rename = "oidcIssuerProfile", default, skip_serializing_if = "Option::is_none")] + pub oidc_issuer_profile: Option, + #[serde(rename = "nodeResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub node_resource_group: Option, + #[serde(rename = "enableRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_rbac: Option, + #[serde(rename = "enablePodSecurityPolicy", default, skip_serializing_if = "Option::is_none")] + pub enable_pod_security_policy: Option, + #[serde(rename = "enableNamespaceResources", default, skip_serializing_if = "Option::is_none")] + pub enable_namespace_resources: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "aadProfile", default, skip_serializing_if = "Option::is_none")] + pub aad_profile: Option, + #[serde(rename = "autoUpgradeProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_profile: Option, + #[serde(rename = "autoScalerProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_scaler_profile: Option, + #[serde(rename = "apiServerAccessProfile", default, skip_serializing_if = "Option::is_none")] + pub api_server_access_profile: Option, + #[serde(rename = "diskEncryptionSetID", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "identityProfile", default, skip_serializing_if = "Option::is_none")] + pub identity_profile: Option, + #[serde(rename = "privateLinkResources", default, skip_serializing_if = "Vec::is_empty")] + pub private_link_resources: Vec, + #[serde(rename = "disableLocalAccounts", default, skip_serializing_if = "Option::is_none")] + pub disable_local_accounts: Option, + #[serde(rename = "httpProxyConfig", default, skip_serializing_if = "Option::is_none")] + pub http_proxy_config: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +pub mod managed_cluster_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct AutoScalerProfile { + #[serde(rename = "balance-similar-node-groups", default, skip_serializing_if = "Option::is_none")] + pub balance_similar_node_groups: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expander: Option, + #[serde(rename = "max-empty-bulk-delete", default, skip_serializing_if = "Option::is_none")] + pub max_empty_bulk_delete: Option, + #[serde(rename = "max-graceful-termination-sec", default, skip_serializing_if = "Option::is_none")] + pub max_graceful_termination_sec: Option, + #[serde(rename = "max-node-provision-time", default, skip_serializing_if = "Option::is_none")] + pub max_node_provision_time: Option, + #[serde(rename = "max-total-unready-percentage", default, skip_serializing_if = "Option::is_none")] + pub max_total_unready_percentage: Option, + #[serde(rename = "new-pod-scale-up-delay", default, skip_serializing_if = "Option::is_none")] + pub new_pod_scale_up_delay: Option, + #[serde(rename = "ok-total-unready-count", default, skip_serializing_if = "Option::is_none")] + pub ok_total_unready_count: Option, + #[serde(rename = "scan-interval", default, skip_serializing_if = "Option::is_none")] + pub scan_interval: Option, + #[serde(rename = "scale-down-delay-after-add", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_add: Option, + #[serde(rename = "scale-down-delay-after-delete", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_delete: Option, + #[serde(rename = "scale-down-delay-after-failure", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_failure: Option, + #[serde(rename = "scale-down-unneeded-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unneeded_time: Option, + #[serde(rename = "scale-down-unready-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unready_time: Option, + #[serde(rename = "scale-down-utilization-threshold", default, skip_serializing_if = "Option::is_none")] + pub scale_down_utilization_threshold: Option, + #[serde(rename = "skip-nodes-with-local-storage", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_local_storage: Option, + #[serde(rename = "skip-nodes-with-system-pods", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_system_pods: Option, + } + pub mod auto_scaler_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Expander { + #[serde(rename = "least-waste")] + LeastWaste, + #[serde(rename = "most-pods")] + MostPods, + #[serde(rename = "priority")] + Priority, + #[serde(rename = "random")] + Random, + } + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod managed_cluster_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Paid, + Free, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSecurityProfile { + #[serde(rename = "azureDefender", default, skip_serializing_if = "Option::is_none")] + pub azure_defender: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSecurityProfileAzureDefender { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "logAnalyticsWorkspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub log_analytics_workspace_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterServicePrincipalProfile { + #[serde(rename = "clientId")] + pub client_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: ManagedClusterUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfileProperties { + #[serde(rename = "controlPlaneProfile")] + pub control_plane_profile: ManagedClusterPoolUpgradeProfile, + #[serde(rename = "agentPoolProfiles")] + pub agent_pool_profiles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterWindowsProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "enableCSIProxy", default, skip_serializing_if = "Option::is_none")] + pub enable_csi_proxy: Option, + #[serde(rename = "gmsaProfile", default, skip_serializing_if = "Option::is_none")] + pub gmsa_profile: Option, +} +pub mod managed_cluster_windows_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + None, + #[serde(rename = "Windows_Server")] + WindowsServer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsDiskType { + Managed, + Ephemeral, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: OsOptionPropertyList, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProperty { + #[serde(rename = "os-type")] + pub os_type: String, + #[serde(rename = "enable-fips-image")] + pub enable_fips_image: bool, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionPropertyList { + #[serde(rename = "osOptionPropertyList")] + pub os_option_property_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Ossku { + Ubuntu, + #[serde(rename = "CBLMariner")] + CblMariner, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsType { + Linux, + Windows, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValue { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValueDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpointCollection { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +pub mod power_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + Running, + Stopped, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, +} +pub mod private_endpoint_connection_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "privateLinkServiceID", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourcesListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +pub type ProximityPlacementGroupId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandRequest { + pub command: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[serde(rename = "clusterToken", default, skip_serializing_if = "Option::is_none")] + pub cluster_token: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleDownMode { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetEvictionPolicy { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetPriority { + Spot, + Regular, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Snapshot { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotProperties { + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[serde(rename = "snapshotType", default, skip_serializing_if = "Option::is_none")] + pub snapshot_type: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osSku", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SnapshotType { + NodePool, +} +pub type SpotMaxPrice = f64; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SysctlConfig { + #[serde(rename = "netCoreSomaxconn", default, skip_serializing_if = "Option::is_none")] + pub net_core_somaxconn: Option, + #[serde(rename = "netCoreNetdevMaxBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_core_netdev_max_backlog: Option, + #[serde(rename = "netCoreRmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_default: Option, + #[serde(rename = "netCoreRmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_max: Option, + #[serde(rename = "netCoreWmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_default: Option, + #[serde(rename = "netCoreWmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_max: Option, + #[serde(rename = "netCoreOptmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_optmem_max: Option, + #[serde(rename = "netIpv4TcpMaxSynBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_syn_backlog: Option, + #[serde(rename = "netIpv4TcpMaxTwBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_tw_buckets: Option, + #[serde(rename = "netIpv4TcpFinTimeout", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_fin_timeout: Option, + #[serde(rename = "netIpv4TcpKeepaliveTime", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_time: Option, + #[serde(rename = "netIpv4TcpKeepaliveProbes", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_probes: Option, + #[serde(rename = "netIpv4TcpkeepaliveIntvl", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcpkeepalive_intvl: Option, + #[serde(rename = "netIpv4TcpTwReuse", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_tw_reuse: Option, + #[serde(rename = "netIpv4IpLocalPortRange", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_ip_local_port_range: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh1", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh1: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh2", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh2: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh3", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh3: Option, + #[serde(rename = "netNetfilterNfConntrackMax", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_max: Option, + #[serde(rename = "netNetfilterNfConntrackBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_buckets: Option, + #[serde(rename = "fsInotifyMaxUserWatches", default, skip_serializing_if = "Option::is_none")] + pub fs_inotify_max_user_watches: Option, + #[serde(rename = "fsFileMax", default, skip_serializing_if = "Option::is_none")] + pub fs_file_max: Option, + #[serde(rename = "fsAioMaxNr", default, skip_serializing_if = "Option::is_none")] + pub fs_aio_max_nr: Option, + #[serde(rename = "fsNrOpen", default, skip_serializing_if = "Option::is_none")] + pub fs_nr_open: Option, + #[serde(rename = "kernelThreadsMax", default, skip_serializing_if = "Option::is_none")] + pub kernel_threads_max: Option, + #[serde(rename = "vmMaxMapCount", default, skip_serializing_if = "Option::is_none")] + pub vm_max_map_count: Option, + #[serde(rename = "vmSwappiness", default, skip_serializing_if = "Option::is_none")] + pub vm_swappiness: Option, + #[serde(rename = "vmVfsCachePressure", default, skip_serializing_if = "Option::is_none")] + pub vm_vfs_cache_pressure: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagsObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimeInWeek { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[serde(rename = "hourSlots", default, skip_serializing_if = "Vec::is_empty")] + pub hour_slots: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimeSpan { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentity { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WeekDay { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WindowsGmsaProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "dnsServer", default, skip_serializing_if = "Option::is_none")] + pub dns_server: Option, + #[serde(rename = "rootDomainName", default, skip_serializing_if = "Option::is_none")] + pub root_domain_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WorkloadRuntime { + #[serde(rename = "OCIContainer")] + OciContainer, + WasmWasi, +} diff --git a/services/mgmt/containerservice/src/package_2021_11_01_preview_only/operations.rs b/services/mgmt/containerservice/src/package_2021_11_01_preview_only/operations.rs new file mode 100644 index 0000000000..98474a8d81 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2021_11_01_preview_only/operations.rs @@ -0,0 +1,4265 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn agent_pools(&self) -> agent_pools::Client { + agent_pools::Client(self.clone()) + } + pub fn maintenance_configurations(&self) -> maintenance_configurations::Client { + maintenance_configurations::Client(self.clone()) + } + pub fn managed_clusters(&self) -> managed_clusters::Client { + managed_clusters::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn resolve_private_link_service_id(&self) -> resolve_private_link_service_id::Client { + resolve_private_link_service_id::Client(self.clone()) + } + pub fn snapshots(&self) -> snapshots::Client { + snapshots::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ManagedClusters_GetOsOptions(#[from] managed_clusters::get_os_options::Error), + #[error(transparent)] + ManagedClusters_List(#[from] managed_clusters::list::Error), + #[error(transparent)] + ManagedClusters_ListByResourceGroup(#[from] managed_clusters::list_by_resource_group::Error), + #[error(transparent)] + ManagedClusters_GetUpgradeProfile(#[from] managed_clusters::get_upgrade_profile::Error), + #[error(transparent)] + ManagedClusters_GetAccessProfile(#[from] managed_clusters::get_access_profile::Error), + #[error(transparent)] + ManagedClusters_ListClusterAdminCredentials(#[from] managed_clusters::list_cluster_admin_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterUserCredentials(#[from] managed_clusters::list_cluster_user_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterMonitoringUserCredentials(#[from] managed_clusters::list_cluster_monitoring_user_credentials::Error), + #[error(transparent)] + ManagedClusters_Get(#[from] managed_clusters::get::Error), + #[error(transparent)] + ManagedClusters_CreateOrUpdate(#[from] managed_clusters::create_or_update::Error), + #[error(transparent)] + ManagedClusters_UpdateTags(#[from] managed_clusters::update_tags::Error), + #[error(transparent)] + ManagedClusters_Delete(#[from] managed_clusters::delete::Error), + #[error(transparent)] + MaintenanceConfigurations_ListByManagedCluster(#[from] maintenance_configurations::list_by_managed_cluster::Error), + #[error(transparent)] + MaintenanceConfigurations_Get(#[from] maintenance_configurations::get::Error), + #[error(transparent)] + MaintenanceConfigurations_CreateOrUpdate(#[from] maintenance_configurations::create_or_update::Error), + #[error(transparent)] + MaintenanceConfigurations_Delete(#[from] maintenance_configurations::delete::Error), + #[error(transparent)] + AgentPools_List(#[from] agent_pools::list::Error), + #[error(transparent)] + AgentPools_Get(#[from] agent_pools::get::Error), + #[error(transparent)] + AgentPools_CreateOrUpdate(#[from] agent_pools::create_or_update::Error), + #[error(transparent)] + AgentPools_Delete(#[from] agent_pools::delete::Error), + #[error(transparent)] + AgentPools_GetUpgradeProfile(#[from] agent_pools::get_upgrade_profile::Error), + #[error(transparent)] + AgentPools_GetAvailableAgentPoolVersions(#[from] agent_pools::get_available_agent_pool_versions::Error), + #[error(transparent)] + ManagedClusters_ResetServicePrincipalProfile(#[from] managed_clusters::reset_service_principal_profile::Error), + #[error(transparent)] + ManagedClusters_ResetAadProfile(#[from] managed_clusters::reset_aad_profile::Error), + #[error(transparent)] + ManagedClusters_RotateClusterCertificates(#[from] managed_clusters::rotate_cluster_certificates::Error), + #[error(transparent)] + ManagedClusters_Stop(#[from] managed_clusters::stop::Error), + #[error(transparent)] + ManagedClusters_Start(#[from] managed_clusters::start::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Update(#[from] private_endpoint_connections::update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + AgentPools_UpgradeNodeImageVersion(#[from] agent_pools::upgrade_node_image_version::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + ResolvePrivateLinkServiceId_Post(#[from] resolve_private_link_service_id::post::Error), + #[error(transparent)] + ManagedClusters_RunCommand(#[from] managed_clusters::run_command::Error), + #[error(transparent)] + ManagedClusters_GetCommandResult(#[from] managed_clusters::get_command_result::Error), + #[error(transparent)] + ManagedClusters_ListOutboundNetworkDependenciesEndpoints(#[from] managed_clusters::list_outbound_network_dependencies_endpoints::Error), + #[error(transparent)] + Snapshots_List(#[from] snapshots::list::Error), + #[error(transparent)] + Snapshots_ListByResourceGroup(#[from] snapshots::list_by_resource_group::Error), + #[error(transparent)] + Snapshots_Get(#[from] snapshots::get::Error), + #[error(transparent)] + Snapshots_CreateOrUpdate(#[from] snapshots::create_or_update::Error), + #[error(transparent)] + Snapshots_UpdateTags(#[from] snapshots::update_tags::Error), + #[error(transparent)] + Snapshots_Delete(#[from] snapshots::delete::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of operations."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_clusters { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets supported OS options in the specified subscription."] + pub fn get_os_options(&self, subscription_id: impl Into, location: impl Into) -> get_os_options::Builder { + get_os_options::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + resource_type: None, + } + } + #[doc = "Gets a list of managed clusters in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists managed clusters in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets the upgrade profile of a managed cluster."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets an access profile of a managed cluster."] + pub fn get_access_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + role_name: impl Into, + ) -> get_access_profile::Builder { + get_access_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + role_name: role_name.into(), + } + } + #[doc = "Lists the admin credentials of a managed cluster."] + pub fn list_cluster_admin_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_admin_credentials::Builder { + list_cluster_admin_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the user credentials of a managed cluster."] + pub fn list_cluster_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_user_credentials::Builder { + list_cluster_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the cluster monitoring user credentials of a managed cluster."] + pub fn list_cluster_monitoring_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_monitoring_user_credentials::Builder { + list_cluster_monitoring_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Gets a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a managed cluster."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Reset the Service Principal Profile of a managed cluster."] + pub fn reset_service_principal_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_service_principal_profile::Builder { + reset_service_principal_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Reset the AAD Profile of a managed cluster."] + pub fn reset_aad_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_aad_profile::Builder { + reset_aad_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Rotates the certificates of a managed cluster."] + pub fn rotate_cluster_certificates( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> rotate_cluster_certificates::Builder { + rotate_cluster_certificates::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Stops a Managed Cluster"] + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Starts a previously stopped Managed Cluster"] + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Submits a command to run against the Managed Cluster."] + pub fn run_command( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + request_payload: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + request_payload: request_payload.into(), + } + } + #[doc = "Gets the results of a command which has been run on the Managed Cluster."] + pub fn get_command_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + command_id: impl Into, + ) -> get_command_result::Builder { + get_command_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + command_id: command_id.into(), + } + } + #[doc = "Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster."] + pub fn list_outbound_network_dependencies_endpoints( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_outbound_network_dependencies_endpoints::Builder { + list_outbound_network_dependencies_endpoints::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod get_os_options { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) resource_type: Option, + } + impl Builder { + pub fn resource_type(mut self, resource_type: impl Into) -> Self { + self.resource_type = Some(resource_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/locations/{}/osOptions/default", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(resource_type) = &self.resource_type { + url.query_pairs_mut().append_pair("resource-type", resource_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsOptionProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_access_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) role_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/accessProfiles/{}/listCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterAccessProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_admin_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterAdminCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_monitoring_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterMonitoringUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedCluster), + Created201(models::ManagedCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedCluster, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_service_principal_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterServicePrincipalProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetServicePrincipalProfile" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_aad_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterAadProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetAADProfile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rotate_cluster_certificates { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/rotateClusterCertificates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) request_payload: models::RunCommandRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/runCommand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_command_result { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) command_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/commandResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.command_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_outbound_network_dependencies_endpoints { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundEnvironmentEndpointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod maintenance_configurations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of maintenance configurations in the specified managed cluster."] + pub fn list_by_managed_cluster( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_by_managed_cluster::Builder { + list_by_managed_cluster::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified maintenance configuration of a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + #[doc = "Creates or updates a maintenance configuration in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a maintenance configuration."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + } + pub mod list_by_managed_cluster { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + pub(crate) parameters: models::MaintenanceConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod agent_pools { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of agent pools in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified managed cluster agent pool."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Creates or updates an agent pool in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes an agent pool in the specified managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets the upgrade profile for an agent pool."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets a list of supported Kubernetes versions for the specified agent pool."] + pub fn get_available_agent_pool_versions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_available_agent_pool_versions::Builder { + get_available_agent_pool_versions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Upgrades the node image version of an agent pool to the latest."] + pub fn upgrade_node_image_version( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> upgrade_node_image_version::Builder { + upgrade_node_image_version::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + pub(crate) parameters: models::AgentPool, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_available_agent_pool_versions { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/availableAgentPoolVersions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolAvailableVersions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod upgrade_node_image_version { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeNodeImageVersion" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private endpoint connections in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified private endpoint connection."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + #[doc = "Updates a private endpoint connection."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a private endpoint connection."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private link resources in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateLinkResources" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resolve_private_link_service_id { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the private link service ID for the specified managed cluster."] + pub fn post( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> post::Builder { + post::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + } + pub mod post { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::PrivateLinkResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resolvePrivateLinkServiceId" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod snapshots { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of snapshots in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists snapshots in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a snapshot."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a snapshot."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a snapshot."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a snapshot."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Created201(models::Snapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::Snapshot, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/containerservice/src/package_preview_2021_11/mod.rs b/services/mgmt/containerservice/src/package_preview_2021_11/mod.rs new file mode 100644 index 0000000000..75f67dfde9 --- /dev/null +++ b/services/mgmt/containerservice/src/package_preview_2021_11/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-11-01-preview"; diff --git a/services/mgmt/containerservice/src/package_preview_2021_11/models.rs b/services/mgmt/containerservice/src/package_preview_2021_11/models.rs new file mode 100644 index 0000000000..f48164fee4 --- /dev/null +++ b/services/mgmt/containerservice/src/package_preview_2021_11/models.rs @@ -0,0 +1,1663 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccessProfile { + #[serde(rename = "kubeConfig", default, skip_serializing_if = "Option::is_none")] + pub kube_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolAvailableVersionsProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersionsProperties { + #[serde(rename = "agentPoolVersions", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_versions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolMode { + System, + User, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolType { + VirtualMachineScaleSets, + AvailabilitySet, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfileProperties { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, + #[serde(rename = "latestNodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_node_image_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeSettings { + #[serde(rename = "maxSurge", default, skip_serializing_if = "Option::is_none")] + pub max_surge: Option, +} +pub type CapacityReservationGroupId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommandResultProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "exitCode", default, skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + #[serde(rename = "startedAt", default, skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[serde(rename = "finishedAt", default, skip_serializing_if = "Option::is_none")] + pub finished_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub logs: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceDiagnosticsProfile { + #[serde(rename = "vmDiagnostics")] + pub vm_diagnostics: ContainerServiceVmDiagnostics, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceLinuxProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + pub ssh: ContainerServiceSshConfiguration, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceMasterProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "dnsPrefix")] + pub dns_prefix: String, + #[serde(rename = "vmSize")] + pub vm_size: ContainerServiceVmSize, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "firstConsecutiveStaticIP", default, skip_serializing_if = "Option::is_none")] + pub first_consecutive_static_ip: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, +} +pub mod container_service_master_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Count {} +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceNetworkProfile { + #[serde(rename = "networkPlugin", default, skip_serializing_if = "Option::is_none")] + pub network_plugin: Option, + #[serde(rename = "networkPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_policy: Option, + #[serde(rename = "networkMode", default, skip_serializing_if = "Option::is_none")] + pub network_mode: Option, + #[serde(rename = "podCidr", default, skip_serializing_if = "Option::is_none")] + pub pod_cidr: Option, + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, + #[serde(rename = "dnsServiceIP", default, skip_serializing_if = "Option::is_none")] + pub dns_service_ip: Option, + #[serde(rename = "dockerBridgeCidr", default, skip_serializing_if = "Option::is_none")] + pub docker_bridge_cidr: Option, + #[serde(rename = "outboundType", default, skip_serializing_if = "Option::is_none")] + pub outbound_type: Option, + #[serde(rename = "loadBalancerSku", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_sku: Option, + #[serde(rename = "loadBalancerProfile", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_profile: Option, + #[serde(rename = "natGatewayProfile", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway_profile: Option, + #[serde(rename = "podCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub pod_cidrs: Vec, + #[serde(rename = "serviceCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub service_cidrs: Vec, + #[serde(rename = "ipFamilies", default, skip_serializing_if = "Vec::is_empty")] + pub ip_families: Vec, +} +pub mod container_service_network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPlugin { + #[serde(rename = "azure")] + Azure, + #[serde(rename = "kubenet")] + Kubenet, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPolicy { + #[serde(rename = "calico")] + Calico, + #[serde(rename = "azure")] + Azure, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkMode { + #[serde(rename = "transparent")] + Transparent, + #[serde(rename = "bridge")] + Bridge, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OutboundType { + #[serde(rename = "loadBalancer")] + LoadBalancer, + #[serde(rename = "userDefinedRouting")] + UserDefinedRouting, + #[serde(rename = "managedNATGateway")] + ManagedNatGateway, + #[serde(rename = "userAssignedNATGateway")] + UserAssignedNatGateway, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoadBalancerSku { + #[serde(rename = "standard")] + Standard, + #[serde(rename = "basic")] + Basic, + } +} +pub type ContainerServiceOsDisk = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshConfiguration { + #[serde(rename = "publicKeys")] + pub public_keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshPublicKey { + #[serde(rename = "keyData")] + pub key_data: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceStorageProfile { + StorageAccount, + ManagedDisks, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceVmDiagnostics { + pub enabled: bool, + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceVmSize { + #[serde(rename = "Standard_A1")] + StandardA1, + #[serde(rename = "Standard_A10")] + StandardA10, + #[serde(rename = "Standard_A11")] + StandardA11, + #[serde(rename = "Standard_A1_v2")] + StandardA1V2, + #[serde(rename = "Standard_A2")] + StandardA2, + #[serde(rename = "Standard_A2_v2")] + StandardA2V2, + #[serde(rename = "Standard_A2m_v2")] + StandardA2mV2, + #[serde(rename = "Standard_A3")] + StandardA3, + #[serde(rename = "Standard_A4")] + StandardA4, + #[serde(rename = "Standard_A4_v2")] + StandardA4V2, + #[serde(rename = "Standard_A4m_v2")] + StandardA4mV2, + #[serde(rename = "Standard_A5")] + StandardA5, + #[serde(rename = "Standard_A6")] + StandardA6, + #[serde(rename = "Standard_A7")] + StandardA7, + #[serde(rename = "Standard_A8")] + StandardA8, + #[serde(rename = "Standard_A8_v2")] + StandardA8V2, + #[serde(rename = "Standard_A8m_v2")] + StandardA8mV2, + #[serde(rename = "Standard_A9")] + StandardA9, + #[serde(rename = "Standard_B2ms")] + StandardB2ms, + #[serde(rename = "Standard_B2s")] + StandardB2s, + #[serde(rename = "Standard_B4ms")] + StandardB4ms, + #[serde(rename = "Standard_B8ms")] + StandardB8ms, + #[serde(rename = "Standard_D1")] + StandardD1, + #[serde(rename = "Standard_D11")] + StandardD11, + #[serde(rename = "Standard_D11_v2")] + StandardD11V2, + #[serde(rename = "Standard_D11_v2_Promo")] + StandardD11V2Promo, + #[serde(rename = "Standard_D12")] + StandardD12, + #[serde(rename = "Standard_D12_v2")] + StandardD12V2, + #[serde(rename = "Standard_D12_v2_Promo")] + StandardD12V2Promo, + #[serde(rename = "Standard_D13")] + StandardD13, + #[serde(rename = "Standard_D13_v2")] + StandardD13V2, + #[serde(rename = "Standard_D13_v2_Promo")] + StandardD13V2Promo, + #[serde(rename = "Standard_D14")] + StandardD14, + #[serde(rename = "Standard_D14_v2")] + StandardD14V2, + #[serde(rename = "Standard_D14_v2_Promo")] + StandardD14V2Promo, + #[serde(rename = "Standard_D15_v2")] + StandardD15V2, + #[serde(rename = "Standard_D16_v3")] + StandardD16V3, + #[serde(rename = "Standard_D16s_v3")] + StandardD16sV3, + #[serde(rename = "Standard_D1_v2")] + StandardD1V2, + #[serde(rename = "Standard_D2")] + StandardD2, + #[serde(rename = "Standard_D2_v2")] + StandardD2V2, + #[serde(rename = "Standard_D2_v2_Promo")] + StandardD2V2Promo, + #[serde(rename = "Standard_D2_v3")] + StandardD2V3, + #[serde(rename = "Standard_D2s_v3")] + StandardD2sV3, + #[serde(rename = "Standard_D3")] + StandardD3, + #[serde(rename = "Standard_D32_v3")] + StandardD32V3, + #[serde(rename = "Standard_D32s_v3")] + StandardD32sV3, + #[serde(rename = "Standard_D3_v2")] + StandardD3V2, + #[serde(rename = "Standard_D3_v2_Promo")] + StandardD3V2Promo, + #[serde(rename = "Standard_D4")] + StandardD4, + #[serde(rename = "Standard_D4_v2")] + StandardD4V2, + #[serde(rename = "Standard_D4_v2_Promo")] + StandardD4V2Promo, + #[serde(rename = "Standard_D4_v3")] + StandardD4V3, + #[serde(rename = "Standard_D4s_v3")] + StandardD4sV3, + #[serde(rename = "Standard_D5_v2")] + StandardD5V2, + #[serde(rename = "Standard_D5_v2_Promo")] + StandardD5V2Promo, + #[serde(rename = "Standard_D64_v3")] + StandardD64V3, + #[serde(rename = "Standard_D64s_v3")] + StandardD64sV3, + #[serde(rename = "Standard_D8_v3")] + StandardD8V3, + #[serde(rename = "Standard_D8s_v3")] + StandardD8sV3, + #[serde(rename = "Standard_DS1")] + StandardDs1, + #[serde(rename = "Standard_DS11")] + StandardDs11, + #[serde(rename = "Standard_DS11_v2")] + StandardDs11V2, + #[serde(rename = "Standard_DS11_v2_Promo")] + StandardDs11V2Promo, + #[serde(rename = "Standard_DS12")] + StandardDs12, + #[serde(rename = "Standard_DS12_v2")] + StandardDs12V2, + #[serde(rename = "Standard_DS12_v2_Promo")] + StandardDs12V2Promo, + #[serde(rename = "Standard_DS13")] + StandardDs13, + #[serde(rename = "Standard_DS13-2_v2")] + StandardDs132V2, + #[serde(rename = "Standard_DS13-4_v2")] + StandardDs134V2, + #[serde(rename = "Standard_DS13_v2")] + StandardDs13V2, + #[serde(rename = "Standard_DS13_v2_Promo")] + StandardDs13V2Promo, + #[serde(rename = "Standard_DS14")] + StandardDs14, + #[serde(rename = "Standard_DS14-4_v2")] + StandardDs144V2, + #[serde(rename = "Standard_DS14-8_v2")] + StandardDs148V2, + #[serde(rename = "Standard_DS14_v2")] + StandardDs14V2, + #[serde(rename = "Standard_DS14_v2_Promo")] + StandardDs14V2Promo, + #[serde(rename = "Standard_DS15_v2")] + StandardDs15V2, + #[serde(rename = "Standard_DS1_v2")] + StandardDs1V2, + #[serde(rename = "Standard_DS2")] + StandardDs2, + #[serde(rename = "Standard_DS2_v2")] + StandardDs2V2, + #[serde(rename = "Standard_DS2_v2_Promo")] + StandardDs2V2Promo, + #[serde(rename = "Standard_DS3")] + StandardDs3, + #[serde(rename = "Standard_DS3_v2")] + StandardDs3V2, + #[serde(rename = "Standard_DS3_v2_Promo")] + StandardDs3V2Promo, + #[serde(rename = "Standard_DS4")] + StandardDs4, + #[serde(rename = "Standard_DS4_v2")] + StandardDs4V2, + #[serde(rename = "Standard_DS4_v2_Promo")] + StandardDs4V2Promo, + #[serde(rename = "Standard_DS5_v2")] + StandardDs5V2, + #[serde(rename = "Standard_DS5_v2_Promo")] + StandardDs5V2Promo, + #[serde(rename = "Standard_E16_v3")] + StandardE16V3, + #[serde(rename = "Standard_E16s_v3")] + StandardE16sV3, + #[serde(rename = "Standard_E2_v3")] + StandardE2V3, + #[serde(rename = "Standard_E2s_v3")] + StandardE2sV3, + #[serde(rename = "Standard_E32-16s_v3")] + StandardE3216sV3, + #[serde(rename = "Standard_E32-8s_v3")] + StandardE328sV3, + #[serde(rename = "Standard_E32_v3")] + StandardE32V3, + #[serde(rename = "Standard_E32s_v3")] + StandardE32sV3, + #[serde(rename = "Standard_E4_v3")] + StandardE4V3, + #[serde(rename = "Standard_E4s_v3")] + StandardE4sV3, + #[serde(rename = "Standard_E64-16s_v3")] + StandardE6416sV3, + #[serde(rename = "Standard_E64-32s_v3")] + StandardE6432sV3, + #[serde(rename = "Standard_E64_v3")] + StandardE64V3, + #[serde(rename = "Standard_E64s_v3")] + StandardE64sV3, + #[serde(rename = "Standard_E8_v3")] + StandardE8V3, + #[serde(rename = "Standard_E8s_v3")] + StandardE8sV3, + #[serde(rename = "Standard_F1")] + StandardF1, + #[serde(rename = "Standard_F16")] + StandardF16, + #[serde(rename = "Standard_F16s")] + StandardF16s, + #[serde(rename = "Standard_F16s_v2")] + StandardF16sV2, + #[serde(rename = "Standard_F1s")] + StandardF1s, + #[serde(rename = "Standard_F2")] + StandardF2, + #[serde(rename = "Standard_F2s")] + StandardF2s, + #[serde(rename = "Standard_F2s_v2")] + StandardF2sV2, + #[serde(rename = "Standard_F32s_v2")] + StandardF32sV2, + #[serde(rename = "Standard_F4")] + StandardF4, + #[serde(rename = "Standard_F4s")] + StandardF4s, + #[serde(rename = "Standard_F4s_v2")] + StandardF4sV2, + #[serde(rename = "Standard_F64s_v2")] + StandardF64sV2, + #[serde(rename = "Standard_F72s_v2")] + StandardF72sV2, + #[serde(rename = "Standard_F8")] + StandardF8, + #[serde(rename = "Standard_F8s")] + StandardF8s, + #[serde(rename = "Standard_F8s_v2")] + StandardF8sV2, + #[serde(rename = "Standard_G1")] + StandardG1, + #[serde(rename = "Standard_G2")] + StandardG2, + #[serde(rename = "Standard_G3")] + StandardG3, + #[serde(rename = "Standard_G4")] + StandardG4, + #[serde(rename = "Standard_G5")] + StandardG5, + #[serde(rename = "Standard_GS1")] + StandardGs1, + #[serde(rename = "Standard_GS2")] + StandardGs2, + #[serde(rename = "Standard_GS3")] + StandardGs3, + #[serde(rename = "Standard_GS4")] + StandardGs4, + #[serde(rename = "Standard_GS4-4")] + StandardGs44, + #[serde(rename = "Standard_GS4-8")] + StandardGs48, + #[serde(rename = "Standard_GS5")] + StandardGs5, + #[serde(rename = "Standard_GS5-16")] + StandardGs516, + #[serde(rename = "Standard_GS5-8")] + StandardGs58, + #[serde(rename = "Standard_H16")] + StandardH16, + #[serde(rename = "Standard_H16m")] + StandardH16m, + #[serde(rename = "Standard_H16mr")] + StandardH16mr, + #[serde(rename = "Standard_H16r")] + StandardH16r, + #[serde(rename = "Standard_H8")] + StandardH8, + #[serde(rename = "Standard_H8m")] + StandardH8m, + #[serde(rename = "Standard_L16s")] + StandardL16s, + #[serde(rename = "Standard_L32s")] + StandardL32s, + #[serde(rename = "Standard_L4s")] + StandardL4s, + #[serde(rename = "Standard_L8s")] + StandardL8s, + #[serde(rename = "Standard_M128-32ms")] + StandardM12832ms, + #[serde(rename = "Standard_M128-64ms")] + StandardM12864ms, + #[serde(rename = "Standard_M128ms")] + StandardM128ms, + #[serde(rename = "Standard_M128s")] + StandardM128s, + #[serde(rename = "Standard_M64-16ms")] + StandardM6416ms, + #[serde(rename = "Standard_M64-32ms")] + StandardM6432ms, + #[serde(rename = "Standard_M64ms")] + StandardM64ms, + #[serde(rename = "Standard_M64s")] + StandardM64s, + #[serde(rename = "Standard_NC12")] + StandardNc12, + #[serde(rename = "Standard_NC12s_v2")] + StandardNc12sV2, + #[serde(rename = "Standard_NC12s_v3")] + StandardNc12sV3, + #[serde(rename = "Standard_NC24")] + StandardNc24, + #[serde(rename = "Standard_NC24r")] + StandardNc24r, + #[serde(rename = "Standard_NC24rs_v2")] + StandardNc24rsV2, + #[serde(rename = "Standard_NC24rs_v3")] + StandardNc24rsV3, + #[serde(rename = "Standard_NC24s_v2")] + StandardNc24sV2, + #[serde(rename = "Standard_NC24s_v3")] + StandardNc24sV3, + #[serde(rename = "Standard_NC6")] + StandardNc6, + #[serde(rename = "Standard_NC6s_v2")] + StandardNc6sV2, + #[serde(rename = "Standard_NC6s_v3")] + StandardNc6sV3, + #[serde(rename = "Standard_ND12s")] + StandardNd12s, + #[serde(rename = "Standard_ND24rs")] + StandardNd24rs, + #[serde(rename = "Standard_ND24s")] + StandardNd24s, + #[serde(rename = "Standard_ND6s")] + StandardNd6s, + #[serde(rename = "Standard_NV12")] + StandardNv12, + #[serde(rename = "Standard_NV24")] + StandardNv24, + #[serde(rename = "Standard_NV6")] + StandardNv6, +} +pub type ContainerServiceVnetSubnetId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreationData { + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResults { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub kubeconfigs: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointDependency { + #[serde(rename = "domainName", default, skip_serializing_if = "Option::is_none")] + pub domain_name: Option, + #[serde(rename = "endpointDetails", default, skip_serializing_if = "Vec::is_empty")] + pub endpoint_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointDetail { + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExtendedLocationType { + EdgeZone, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum GpuInstanceProfile { + #[serde(rename = "MIG1g")] + Mig1g, + #[serde(rename = "MIG2g")] + Mig2g, + #[serde(rename = "MIG3g")] + Mig3g, + #[serde(rename = "MIG4g")] + Mig4g, + #[serde(rename = "MIG7g")] + Mig7g, +} +pub type HourInDay = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubeletConfig { + #[serde(rename = "cpuManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub cpu_manager_policy: Option, + #[serde(rename = "cpuCfsQuota", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota: Option, + #[serde(rename = "cpuCfsQuotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota_period: Option, + #[serde(rename = "imageGcHighThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_high_threshold: Option, + #[serde(rename = "imageGcLowThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_low_threshold: Option, + #[serde(rename = "topologyManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub topology_manager_policy: Option, + #[serde(rename = "allowedUnsafeSysctls", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_unsafe_sysctls: Vec, + #[serde(rename = "failSwapOn", default, skip_serializing_if = "Option::is_none")] + pub fail_swap_on: Option, + #[serde(rename = "containerLogMaxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_size_mb: Option, + #[serde(rename = "containerLogMaxFiles", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_files: Option, + #[serde(rename = "podMaxPids", default, skip_serializing_if = "Option::is_none")] + pub pod_max_pids: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KubeletDiskType { + #[serde(rename = "OS")] + Os, + Temporary, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinuxOsConfig { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sysctls: Option, + #[serde(rename = "transparentHugePageEnabled", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_enabled: Option, + #[serde(rename = "transparentHugePageDefrag", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_defrag: Option, + #[serde(rename = "swapFileSizeMB", default, skip_serializing_if = "Option::is_none")] + pub swap_file_size_mb: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfigurationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaintenanceConfigurationProperties { + #[serde(rename = "timeInWeek", default, skip_serializing_if = "Vec::is_empty")] + pub time_in_week: Vec, + #[serde(rename = "notAllowedTime", default, skip_serializing_if = "Vec::is_empty")] + pub not_allowed_time: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCluster { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAadProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub managed: Option, + #[serde(rename = "enableAzureRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_azure_rbac: Option, + #[serde(rename = "adminGroupObjectIDs", default, skip_serializing_if = "Vec::is_empty")] + pub admin_group_object_i_ds: Vec, + #[serde(rename = "clientAppID", default, skip_serializing_if = "Option::is_none")] + pub client_app_id: Option, + #[serde(rename = "serverAppID", default, skip_serializing_if = "Option::is_none")] + pub server_app_id: Option, + #[serde(rename = "serverAppSecret", default, skip_serializing_if = "Option::is_none")] + pub server_app_secret: Option, + #[serde(rename = "tenantID", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterApiServerAccessProfile { + #[serde(rename = "authorizedIPRanges", default, skip_serializing_if = "Vec::is_empty")] + pub authorized_ip_ranges: Vec, + #[serde(rename = "enablePrivateCluster", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster: Option, + #[serde(rename = "privateDNSZone", default, skip_serializing_if = "Option::is_none")] + pub private_dns_zone: Option, + #[serde(rename = "enablePrivateClusterPublicFQDN", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster_public_fqdn: Option, + #[serde(rename = "disableRunCommand", default, skip_serializing_if = "Option::is_none")] + pub disable_run_command: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAccessProfile { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAddonProfile { + pub enabled: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub config: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfile { + #[serde(flatten)] + pub managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties, + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfileProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "osDiskType", default, skip_serializing_if = "Option::is_none")] + pub os_disk_type: Option, + #[serde(rename = "kubeletDiskType", default, skip_serializing_if = "Option::is_none")] + pub kubelet_disk_type: Option, + #[serde(rename = "workloadRuntime", default, skip_serializing_if = "Option::is_none")] + pub workload_runtime: Option, + #[serde(rename = "messageOfTheDay", default, skip_serializing_if = "Option::is_none")] + pub message_of_the_day: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "podSubnetID", default, skip_serializing_if = "Option::is_none")] + pub pod_subnet_id: Option, + #[serde(rename = "maxPods", default, skip_serializing_if = "Option::is_none")] + pub max_pods: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osSKU", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[serde(rename = "maxCount", default, skip_serializing_if = "Option::is_none")] + pub max_count: Option, + #[serde(rename = "minCount", default, skip_serializing_if = "Option::is_none")] + pub min_count: Option, + #[serde(rename = "enableAutoScaling", default, skip_serializing_if = "Option::is_none")] + pub enable_auto_scaling: Option, + #[serde(rename = "scaleDownMode", default, skip_serializing_if = "Option::is_none")] + pub scale_down_mode: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "orchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "upgradeSettings", default, skip_serializing_if = "Option::is_none")] + pub upgrade_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "availabilityZones", default, skip_serializing_if = "Vec::is_empty")] + pub availability_zones: Vec, + #[serde(rename = "enableNodePublicIP", default, skip_serializing_if = "Option::is_none")] + pub enable_node_public_ip: Option, + #[serde(rename = "nodePublicIPPrefixID", default, skip_serializing_if = "Option::is_none")] + pub node_public_ip_prefix_id: Option, + #[serde(rename = "scaleSetPriority", default, skip_serializing_if = "Option::is_none")] + pub scale_set_priority: Option, + #[serde(rename = "scaleSetEvictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_set_eviction_policy: Option, + #[serde(rename = "spotMaxPrice", default, skip_serializing_if = "Option::is_none")] + pub spot_max_price: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "nodeLabels", default, skip_serializing_if = "Option::is_none")] + pub node_labels: Option, + #[serde(rename = "nodeTaints", default, skip_serializing_if = "Vec::is_empty")] + pub node_taints: Vec, + #[serde(rename = "proximityPlacementGroupID", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group_id: Option, + #[serde(rename = "kubeletConfig", default, skip_serializing_if = "Option::is_none")] + pub kubelet_config: Option, + #[serde(rename = "linuxOSConfig", default, skip_serializing_if = "Option::is_none")] + pub linux_os_config: Option, + #[serde(rename = "enableEncryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub enable_encryption_at_host: Option, + #[serde(rename = "enableUltraSSD", default, skip_serializing_if = "Option::is_none")] + pub enable_ultra_ssd: Option, + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, + #[serde(rename = "gpuInstanceProfile", default, skip_serializing_if = "Option::is_none")] + pub gpu_instance_profile: Option, + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[serde(rename = "capacityReservationGroupID", default, skip_serializing_if = "Option::is_none")] + pub capacity_reservation_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAutoUpgradeProfile { + #[serde(rename = "upgradeChannel", default, skip_serializing_if = "Option::is_none")] + pub upgrade_channel: Option, +} +pub mod managed_cluster_auto_upgrade_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpgradeChannel { + #[serde(rename = "rapid")] + Rapid, + #[serde(rename = "stable")] + Stable, + #[serde(rename = "patch")] + Patch, + #[serde(rename = "node-image")] + NodeImage, + #[serde(rename = "none")] + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterHttpProxyConfig { + #[serde(rename = "httpProxy", default, skip_serializing_if = "Option::is_none")] + pub http_proxy: Option, + #[serde(rename = "httpsProxy", default, skip_serializing_if = "Option::is_none")] + pub https_proxy: Option, + #[serde(rename = "noProxy", default, skip_serializing_if = "Vec::is_empty")] + pub no_proxy: Vec, + #[serde(rename = "trustedCa", default, skip_serializing_if = "Option::is_none")] + pub trusted_ca: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod managed_cluster_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterLoadBalancerProfile { + #[serde(rename = "managedOutboundIPs", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_i_ps: Option, + #[serde(rename = "outboundIPPrefixes", default, skip_serializing_if = "Option::is_none")] + pub outbound_ip_prefixes: Option, + #[serde(rename = "outboundIPs", default, skip_serializing_if = "Option::is_none")] + pub outbound_i_ps: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "allocatedOutboundPorts", default, skip_serializing_if = "Option::is_none")] + pub allocated_outbound_ports: Option, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[serde(rename = "enableMultipleStandardLoadBalancers", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_standard_load_balancers: Option, +} +pub mod managed_cluster_load_balancer_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ManagedOutboundIPs { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "countIPv6", default, skip_serializing_if = "Option::is_none")] + pub count_i_pv6: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIpPrefixes { + #[serde(rename = "publicIPPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIPs { + #[serde(rename = "publicIPs", default, skip_serializing_if = "Vec::is_empty")] + pub public_i_ps: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterManagedOutboundIpProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterNatGatewayProfile { + #[serde(rename = "managedOutboundIPProfile", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_ip_profile: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterOidcIssuerProfile { + #[serde(rename = "issuerURL", default, skip_serializing_if = "Option::is_none")] + pub issuer_url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentity { + pub name: String, + pub namespace: String, + #[serde(rename = "bindingSelector", default, skip_serializing_if = "Option::is_none")] + pub binding_selector: Option, + pub identity: UserAssignedIdentity, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisioningInfo", default, skip_serializing_if = "Option::is_none")] + pub provisioning_info: Option, +} +pub mod managed_cluster_pod_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Assigned, + Updating, + Deleting, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ProvisioningInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityException { + pub name: String, + pub namespace: String, + #[serde(rename = "podLabels")] + pub pod_labels: serde_json::Value, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "allowNetworkPluginKubenet", default, skip_serializing_if = "Option::is_none")] + pub allow_network_plugin_kubenet: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identities: Vec, + #[serde(rename = "userAssignedIdentityExceptions", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identity_exceptions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProvisioningError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProvisioningErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPoolUpgradeProfile { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "maxAgentPools", default, skip_serializing_if = "Option::is_none")] + pub max_agent_pools: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "currentKubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub current_kubernetes_version: Option, + #[serde(rename = "dnsPrefix", default, skip_serializing_if = "Option::is_none")] + pub dns_prefix: Option, + #[serde(rename = "fqdnSubdomain", default, skip_serializing_if = "Option::is_none")] + pub fqdn_subdomain: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "privateFQDN", default, skip_serializing_if = "Option::is_none")] + pub private_fqdn: Option, + #[serde(rename = "azurePortalFQDN", default, skip_serializing_if = "Option::is_none")] + pub azure_portal_fqdn: Option, + #[serde(rename = "agentPoolProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_profiles: Vec, + #[serde(rename = "linuxProfile", default, skip_serializing_if = "Option::is_none")] + pub linux_profile: Option, + #[serde(rename = "windowsProfile", default, skip_serializing_if = "Option::is_none")] + pub windows_profile: Option, + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[serde(rename = "addonProfiles", default, skip_serializing_if = "Option::is_none")] + pub addon_profiles: Option, + #[serde(rename = "podIdentityProfile", default, skip_serializing_if = "Option::is_none")] + pub pod_identity_profile: Option, + #[serde(rename = "oidcIssuerProfile", default, skip_serializing_if = "Option::is_none")] + pub oidc_issuer_profile: Option, + #[serde(rename = "nodeResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub node_resource_group: Option, + #[serde(rename = "enableRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_rbac: Option, + #[serde(rename = "enablePodSecurityPolicy", default, skip_serializing_if = "Option::is_none")] + pub enable_pod_security_policy: Option, + #[serde(rename = "enableNamespaceResources", default, skip_serializing_if = "Option::is_none")] + pub enable_namespace_resources: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "aadProfile", default, skip_serializing_if = "Option::is_none")] + pub aad_profile: Option, + #[serde(rename = "autoUpgradeProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_profile: Option, + #[serde(rename = "autoScalerProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_scaler_profile: Option, + #[serde(rename = "apiServerAccessProfile", default, skip_serializing_if = "Option::is_none")] + pub api_server_access_profile: Option, + #[serde(rename = "diskEncryptionSetID", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "identityProfile", default, skip_serializing_if = "Option::is_none")] + pub identity_profile: Option, + #[serde(rename = "privateLinkResources", default, skip_serializing_if = "Vec::is_empty")] + pub private_link_resources: Vec, + #[serde(rename = "disableLocalAccounts", default, skip_serializing_if = "Option::is_none")] + pub disable_local_accounts: Option, + #[serde(rename = "httpProxyConfig", default, skip_serializing_if = "Option::is_none")] + pub http_proxy_config: Option, + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +pub mod managed_cluster_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct AutoScalerProfile { + #[serde(rename = "balance-similar-node-groups", default, skip_serializing_if = "Option::is_none")] + pub balance_similar_node_groups: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expander: Option, + #[serde(rename = "max-empty-bulk-delete", default, skip_serializing_if = "Option::is_none")] + pub max_empty_bulk_delete: Option, + #[serde(rename = "max-graceful-termination-sec", default, skip_serializing_if = "Option::is_none")] + pub max_graceful_termination_sec: Option, + #[serde(rename = "max-node-provision-time", default, skip_serializing_if = "Option::is_none")] + pub max_node_provision_time: Option, + #[serde(rename = "max-total-unready-percentage", default, skip_serializing_if = "Option::is_none")] + pub max_total_unready_percentage: Option, + #[serde(rename = "new-pod-scale-up-delay", default, skip_serializing_if = "Option::is_none")] + pub new_pod_scale_up_delay: Option, + #[serde(rename = "ok-total-unready-count", default, skip_serializing_if = "Option::is_none")] + pub ok_total_unready_count: Option, + #[serde(rename = "scan-interval", default, skip_serializing_if = "Option::is_none")] + pub scan_interval: Option, + #[serde(rename = "scale-down-delay-after-add", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_add: Option, + #[serde(rename = "scale-down-delay-after-delete", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_delete: Option, + #[serde(rename = "scale-down-delay-after-failure", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_failure: Option, + #[serde(rename = "scale-down-unneeded-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unneeded_time: Option, + #[serde(rename = "scale-down-unready-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unready_time: Option, + #[serde(rename = "scale-down-utilization-threshold", default, skip_serializing_if = "Option::is_none")] + pub scale_down_utilization_threshold: Option, + #[serde(rename = "skip-nodes-with-local-storage", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_local_storage: Option, + #[serde(rename = "skip-nodes-with-system-pods", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_system_pods: Option, + } + pub mod auto_scaler_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Expander { + #[serde(rename = "least-waste")] + LeastWaste, + #[serde(rename = "most-pods")] + MostPods, + #[serde(rename = "priority")] + Priority, + #[serde(rename = "random")] + Random, + } + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod managed_cluster_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Paid, + Free, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSecurityProfile { + #[serde(rename = "azureDefender", default, skip_serializing_if = "Option::is_none")] + pub azure_defender: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSecurityProfileAzureDefender { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "logAnalyticsWorkspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub log_analytics_workspace_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterServicePrincipalProfile { + #[serde(rename = "clientId")] + pub client_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: ManagedClusterUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfileProperties { + #[serde(rename = "controlPlaneProfile")] + pub control_plane_profile: ManagedClusterPoolUpgradeProfile, + #[serde(rename = "agentPoolProfiles")] + pub agent_pool_profiles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterWindowsProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "enableCSIProxy", default, skip_serializing_if = "Option::is_none")] + pub enable_csi_proxy: Option, + #[serde(rename = "gmsaProfile", default, skip_serializing_if = "Option::is_none")] + pub gmsa_profile: Option, +} +pub mod managed_cluster_windows_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + None, + #[serde(rename = "Windows_Server")] + WindowsServer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsDiskType { + Managed, + Ephemeral, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: OsOptionPropertyList, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProperty { + #[serde(rename = "os-type")] + pub os_type: String, + #[serde(rename = "enable-fips-image")] + pub enable_fips_image: bool, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionPropertyList { + #[serde(rename = "osOptionPropertyList")] + pub os_option_property_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Ossku { + Ubuntu, + #[serde(rename = "CBLMariner")] + CblMariner, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsType { + Linux, + Windows, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValue { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValueDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpointCollection { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +pub mod power_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + Running, + Stopped, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, +} +pub mod private_endpoint_connection_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "privateLinkServiceID", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourcesListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +pub type ProximityPlacementGroupId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandRequest { + pub command: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[serde(rename = "clusterToken", default, skip_serializing_if = "Option::is_none")] + pub cluster_token: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleDownMode { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetEvictionPolicy { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetPriority { + Spot, + Regular, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Snapshot { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotProperties { + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[serde(rename = "snapshotType", default, skip_serializing_if = "Option::is_none")] + pub snapshot_type: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osSku", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SnapshotType { + NodePool, +} +pub type SpotMaxPrice = f64; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SysctlConfig { + #[serde(rename = "netCoreSomaxconn", default, skip_serializing_if = "Option::is_none")] + pub net_core_somaxconn: Option, + #[serde(rename = "netCoreNetdevMaxBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_core_netdev_max_backlog: Option, + #[serde(rename = "netCoreRmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_default: Option, + #[serde(rename = "netCoreRmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_max: Option, + #[serde(rename = "netCoreWmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_default: Option, + #[serde(rename = "netCoreWmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_max: Option, + #[serde(rename = "netCoreOptmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_optmem_max: Option, + #[serde(rename = "netIpv4TcpMaxSynBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_syn_backlog: Option, + #[serde(rename = "netIpv4TcpMaxTwBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_tw_buckets: Option, + #[serde(rename = "netIpv4TcpFinTimeout", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_fin_timeout: Option, + #[serde(rename = "netIpv4TcpKeepaliveTime", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_time: Option, + #[serde(rename = "netIpv4TcpKeepaliveProbes", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_probes: Option, + #[serde(rename = "netIpv4TcpkeepaliveIntvl", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcpkeepalive_intvl: Option, + #[serde(rename = "netIpv4TcpTwReuse", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_tw_reuse: Option, + #[serde(rename = "netIpv4IpLocalPortRange", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_ip_local_port_range: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh1", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh1: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh2", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh2: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh3", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh3: Option, + #[serde(rename = "netNetfilterNfConntrackMax", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_max: Option, + #[serde(rename = "netNetfilterNfConntrackBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_buckets: Option, + #[serde(rename = "fsInotifyMaxUserWatches", default, skip_serializing_if = "Option::is_none")] + pub fs_inotify_max_user_watches: Option, + #[serde(rename = "fsFileMax", default, skip_serializing_if = "Option::is_none")] + pub fs_file_max: Option, + #[serde(rename = "fsAioMaxNr", default, skip_serializing_if = "Option::is_none")] + pub fs_aio_max_nr: Option, + #[serde(rename = "fsNrOpen", default, skip_serializing_if = "Option::is_none")] + pub fs_nr_open: Option, + #[serde(rename = "kernelThreadsMax", default, skip_serializing_if = "Option::is_none")] + pub kernel_threads_max: Option, + #[serde(rename = "vmMaxMapCount", default, skip_serializing_if = "Option::is_none")] + pub vm_max_map_count: Option, + #[serde(rename = "vmSwappiness", default, skip_serializing_if = "Option::is_none")] + pub vm_swappiness: Option, + #[serde(rename = "vmVfsCachePressure", default, skip_serializing_if = "Option::is_none")] + pub vm_vfs_cache_pressure: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagsObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimeInWeek { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[serde(rename = "hourSlots", default, skip_serializing_if = "Vec::is_empty")] + pub hour_slots: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TimeSpan { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentity { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WeekDay { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WindowsGmsaProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "dnsServer", default, skip_serializing_if = "Option::is_none")] + pub dns_server: Option, + #[serde(rename = "rootDomainName", default, skip_serializing_if = "Option::is_none")] + pub root_domain_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WorkloadRuntime { + #[serde(rename = "OCIContainer")] + OciContainer, + WasmWasi, +} diff --git a/services/mgmt/containerservice/src/package_preview_2021_11/operations.rs b/services/mgmt/containerservice/src/package_preview_2021_11/operations.rs new file mode 100644 index 0000000000..98474a8d81 --- /dev/null +++ b/services/mgmt/containerservice/src/package_preview_2021_11/operations.rs @@ -0,0 +1,4265 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn agent_pools(&self) -> agent_pools::Client { + agent_pools::Client(self.clone()) + } + pub fn maintenance_configurations(&self) -> maintenance_configurations::Client { + maintenance_configurations::Client(self.clone()) + } + pub fn managed_clusters(&self) -> managed_clusters::Client { + managed_clusters::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn resolve_private_link_service_id(&self) -> resolve_private_link_service_id::Client { + resolve_private_link_service_id::Client(self.clone()) + } + pub fn snapshots(&self) -> snapshots::Client { + snapshots::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ManagedClusters_GetOsOptions(#[from] managed_clusters::get_os_options::Error), + #[error(transparent)] + ManagedClusters_List(#[from] managed_clusters::list::Error), + #[error(transparent)] + ManagedClusters_ListByResourceGroup(#[from] managed_clusters::list_by_resource_group::Error), + #[error(transparent)] + ManagedClusters_GetUpgradeProfile(#[from] managed_clusters::get_upgrade_profile::Error), + #[error(transparent)] + ManagedClusters_GetAccessProfile(#[from] managed_clusters::get_access_profile::Error), + #[error(transparent)] + ManagedClusters_ListClusterAdminCredentials(#[from] managed_clusters::list_cluster_admin_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterUserCredentials(#[from] managed_clusters::list_cluster_user_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterMonitoringUserCredentials(#[from] managed_clusters::list_cluster_monitoring_user_credentials::Error), + #[error(transparent)] + ManagedClusters_Get(#[from] managed_clusters::get::Error), + #[error(transparent)] + ManagedClusters_CreateOrUpdate(#[from] managed_clusters::create_or_update::Error), + #[error(transparent)] + ManagedClusters_UpdateTags(#[from] managed_clusters::update_tags::Error), + #[error(transparent)] + ManagedClusters_Delete(#[from] managed_clusters::delete::Error), + #[error(transparent)] + MaintenanceConfigurations_ListByManagedCluster(#[from] maintenance_configurations::list_by_managed_cluster::Error), + #[error(transparent)] + MaintenanceConfigurations_Get(#[from] maintenance_configurations::get::Error), + #[error(transparent)] + MaintenanceConfigurations_CreateOrUpdate(#[from] maintenance_configurations::create_or_update::Error), + #[error(transparent)] + MaintenanceConfigurations_Delete(#[from] maintenance_configurations::delete::Error), + #[error(transparent)] + AgentPools_List(#[from] agent_pools::list::Error), + #[error(transparent)] + AgentPools_Get(#[from] agent_pools::get::Error), + #[error(transparent)] + AgentPools_CreateOrUpdate(#[from] agent_pools::create_or_update::Error), + #[error(transparent)] + AgentPools_Delete(#[from] agent_pools::delete::Error), + #[error(transparent)] + AgentPools_GetUpgradeProfile(#[from] agent_pools::get_upgrade_profile::Error), + #[error(transparent)] + AgentPools_GetAvailableAgentPoolVersions(#[from] agent_pools::get_available_agent_pool_versions::Error), + #[error(transparent)] + ManagedClusters_ResetServicePrincipalProfile(#[from] managed_clusters::reset_service_principal_profile::Error), + #[error(transparent)] + ManagedClusters_ResetAadProfile(#[from] managed_clusters::reset_aad_profile::Error), + #[error(transparent)] + ManagedClusters_RotateClusterCertificates(#[from] managed_clusters::rotate_cluster_certificates::Error), + #[error(transparent)] + ManagedClusters_Stop(#[from] managed_clusters::stop::Error), + #[error(transparent)] + ManagedClusters_Start(#[from] managed_clusters::start::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Update(#[from] private_endpoint_connections::update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + AgentPools_UpgradeNodeImageVersion(#[from] agent_pools::upgrade_node_image_version::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + ResolvePrivateLinkServiceId_Post(#[from] resolve_private_link_service_id::post::Error), + #[error(transparent)] + ManagedClusters_RunCommand(#[from] managed_clusters::run_command::Error), + #[error(transparent)] + ManagedClusters_GetCommandResult(#[from] managed_clusters::get_command_result::Error), + #[error(transparent)] + ManagedClusters_ListOutboundNetworkDependenciesEndpoints(#[from] managed_clusters::list_outbound_network_dependencies_endpoints::Error), + #[error(transparent)] + Snapshots_List(#[from] snapshots::list::Error), + #[error(transparent)] + Snapshots_ListByResourceGroup(#[from] snapshots::list_by_resource_group::Error), + #[error(transparent)] + Snapshots_Get(#[from] snapshots::get::Error), + #[error(transparent)] + Snapshots_CreateOrUpdate(#[from] snapshots::create_or_update::Error), + #[error(transparent)] + Snapshots_UpdateTags(#[from] snapshots::update_tags::Error), + #[error(transparent)] + Snapshots_Delete(#[from] snapshots::delete::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of operations."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_clusters { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets supported OS options in the specified subscription."] + pub fn get_os_options(&self, subscription_id: impl Into, location: impl Into) -> get_os_options::Builder { + get_os_options::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + resource_type: None, + } + } + #[doc = "Gets a list of managed clusters in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists managed clusters in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets the upgrade profile of a managed cluster."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets an access profile of a managed cluster."] + pub fn get_access_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + role_name: impl Into, + ) -> get_access_profile::Builder { + get_access_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + role_name: role_name.into(), + } + } + #[doc = "Lists the admin credentials of a managed cluster."] + pub fn list_cluster_admin_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_admin_credentials::Builder { + list_cluster_admin_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the user credentials of a managed cluster."] + pub fn list_cluster_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_user_credentials::Builder { + list_cluster_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the cluster monitoring user credentials of a managed cluster."] + pub fn list_cluster_monitoring_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_monitoring_user_credentials::Builder { + list_cluster_monitoring_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Gets a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a managed cluster."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Reset the Service Principal Profile of a managed cluster."] + pub fn reset_service_principal_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_service_principal_profile::Builder { + reset_service_principal_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Reset the AAD Profile of a managed cluster."] + pub fn reset_aad_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_aad_profile::Builder { + reset_aad_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Rotates the certificates of a managed cluster."] + pub fn rotate_cluster_certificates( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> rotate_cluster_certificates::Builder { + rotate_cluster_certificates::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Stops a Managed Cluster"] + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Starts a previously stopped Managed Cluster"] + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Submits a command to run against the Managed Cluster."] + pub fn run_command( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + request_payload: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + request_payload: request_payload.into(), + } + } + #[doc = "Gets the results of a command which has been run on the Managed Cluster."] + pub fn get_command_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + command_id: impl Into, + ) -> get_command_result::Builder { + get_command_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + command_id: command_id.into(), + } + } + #[doc = "Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster."] + pub fn list_outbound_network_dependencies_endpoints( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_outbound_network_dependencies_endpoints::Builder { + list_outbound_network_dependencies_endpoints::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod get_os_options { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) resource_type: Option, + } + impl Builder { + pub fn resource_type(mut self, resource_type: impl Into) -> Self { + self.resource_type = Some(resource_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/locations/{}/osOptions/default", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(resource_type) = &self.resource_type { + url.query_pairs_mut().append_pair("resource-type", resource_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsOptionProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_access_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) role_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/accessProfiles/{}/listCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterAccessProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_admin_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterAdminCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_monitoring_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterMonitoringUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedCluster), + Created201(models::ManagedCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedCluster, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_service_principal_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterServicePrincipalProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetServicePrincipalProfile" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_aad_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterAadProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetAADProfile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rotate_cluster_certificates { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/rotateClusterCertificates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) request_payload: models::RunCommandRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/runCommand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_command_result { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) command_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/commandResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.command_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_outbound_network_dependencies_endpoints { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundEnvironmentEndpointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod maintenance_configurations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of maintenance configurations in the specified managed cluster."] + pub fn list_by_managed_cluster( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_by_managed_cluster::Builder { + list_by_managed_cluster::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified maintenance configuration of a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + #[doc = "Creates or updates a maintenance configuration in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a maintenance configuration."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + } + pub mod list_by_managed_cluster { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + pub(crate) parameters: models::MaintenanceConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod agent_pools { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of agent pools in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified managed cluster agent pool."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Creates or updates an agent pool in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes an agent pool in the specified managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets the upgrade profile for an agent pool."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets a list of supported Kubernetes versions for the specified agent pool."] + pub fn get_available_agent_pool_versions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_available_agent_pool_versions::Builder { + get_available_agent_pool_versions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Upgrades the node image version of an agent pool to the latest."] + pub fn upgrade_node_image_version( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> upgrade_node_image_version::Builder { + upgrade_node_image_version::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + pub(crate) parameters: models::AgentPool, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_available_agent_pool_versions { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/availableAgentPoolVersions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolAvailableVersions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod upgrade_node_image_version { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeNodeImageVersion" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private endpoint connections in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified private endpoint connection."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + #[doc = "Updates a private endpoint connection."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a private endpoint connection."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private link resources in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateLinkResources" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resolve_private_link_service_id { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the private link service ID for the specified managed cluster."] + pub fn post( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> post::Builder { + post::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + } + pub mod post { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::PrivateLinkResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resolvePrivateLinkServiceId" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod snapshots { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of snapshots in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists snapshots in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a snapshot."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a snapshot."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a snapshot."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a snapshot."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Created201(models::Snapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::Snapshot, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/mod.rs b/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/mod.rs new file mode 100644 index 0000000000..0636d357e8 --- /dev/null +++ b/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2020-11-01"; diff --git a/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/models.rs b/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/models.rs new file mode 100644 index 0000000000..e29b492ebf --- /dev/null +++ b/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/models.rs @@ -0,0 +1,1390 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccessProfile { + #[serde(rename = "kubeConfig", default, skip_serializing_if = "Option::is_none")] + pub kube_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolAvailableVersionsProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersionsProperties { + #[serde(rename = "agentPoolVersions", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_versions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolMode { + System, + User, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolType { + VirtualMachineScaleSets, + AvailabilitySet, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: AgentPoolUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfileProperties { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, + #[serde(rename = "latestNodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_node_image_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeSettings { + #[serde(rename = "maxSurge", default, skip_serializing_if = "Option::is_none")] + pub max_surge: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerService { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceAgentPoolProfile { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "vmSize")] + pub vm_size: ContainerServiceVmSize, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "dnsPrefix", default, skip_serializing_if = "Option::is_none")] + pub dns_prefix: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ports: Vec, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceCustomProfile { + pub orchestrator: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceDiagnosticsProfile { + #[serde(rename = "vmDiagnostics")] + pub vm_diagnostics: ContainerServiceVmDiagnostics, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceLinuxProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + pub ssh: ContainerServiceSshConfiguration, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceMasterProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "dnsPrefix")] + pub dns_prefix: String, + #[serde(rename = "vmSize")] + pub vm_size: ContainerServiceVmSize, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "firstConsecutiveStaticIP", default, skip_serializing_if = "Option::is_none")] + pub first_consecutive_static_ip: Option, + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, +} +pub mod container_service_master_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Count {} +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceNetworkProfile { + #[serde(rename = "networkPlugin", default, skip_serializing_if = "Option::is_none")] + pub network_plugin: Option, + #[serde(rename = "networkPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_policy: Option, + #[serde(rename = "networkMode", default, skip_serializing_if = "Option::is_none")] + pub network_mode: Option, + #[serde(rename = "podCidr", default, skip_serializing_if = "Option::is_none")] + pub pod_cidr: Option, + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, + #[serde(rename = "dnsServiceIP", default, skip_serializing_if = "Option::is_none")] + pub dns_service_ip: Option, + #[serde(rename = "dockerBridgeCidr", default, skip_serializing_if = "Option::is_none")] + pub docker_bridge_cidr: Option, + #[serde(rename = "outboundType", default, skip_serializing_if = "Option::is_none")] + pub outbound_type: Option, + #[serde(rename = "loadBalancerSku", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_sku: Option, + #[serde(rename = "loadBalancerProfile", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_profile: Option, +} +pub mod container_service_network_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPlugin { + #[serde(rename = "azure")] + Azure, + #[serde(rename = "kubenet")] + Kubenet, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPolicy { + #[serde(rename = "calico")] + Calico, + #[serde(rename = "azure")] + Azure, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkMode { + #[serde(rename = "transparent")] + Transparent, + #[serde(rename = "bridge")] + Bridge, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OutboundType { + #[serde(rename = "loadBalancer")] + LoadBalancer, + #[serde(rename = "userDefinedRouting")] + UserDefinedRouting, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoadBalancerSku { + #[serde(rename = "standard")] + Standard, + #[serde(rename = "basic")] + Basic, + } +} +pub type ContainerServiceOsDisk = i32; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceOrchestratorProfile { + #[serde(rename = "orchestratorType")] + pub orchestrator_type: container_service_orchestrator_profile::OrchestratorType, + #[serde(rename = "orchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_version: Option, +} +pub mod container_service_orchestrator_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OrchestratorType { + Kubernetes, + Swarm, + #[serde(rename = "DCOS")] + Dcos, + #[serde(rename = "DockerCE")] + DockerCe, + Custom, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "orchestratorProfile")] + pub orchestrator_profile: ContainerServiceOrchestratorProfile, + #[serde(rename = "customProfile", default, skip_serializing_if = "Option::is_none")] + pub custom_profile: Option, + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[serde(rename = "masterProfile")] + pub master_profile: ContainerServiceMasterProfile, + #[serde(rename = "agentPoolProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_profiles: Vec, + #[serde(rename = "windowsProfile", default, skip_serializing_if = "Option::is_none")] + pub windows_profile: Option, + #[serde(rename = "linuxProfile")] + pub linux_profile: ContainerServiceLinuxProfile, + #[serde(rename = "diagnosticsProfile", default, skip_serializing_if = "Option::is_none")] + pub diagnostics_profile: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceServicePrincipalProfile { + #[serde(rename = "clientId")] + pub client_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, + #[serde(rename = "keyVaultSecretRef", default, skip_serializing_if = "Option::is_none")] + pub key_vault_secret_ref: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshConfiguration { + #[serde(rename = "publicKeys")] + pub public_keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshPublicKey { + #[serde(rename = "keyData")] + pub key_data: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceStorageProfile { + StorageAccount, + ManagedDisks, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceVmDiagnostics { + pub enabled: bool, + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceVmSize { + #[serde(rename = "Standard_A1")] + StandardA1, + #[serde(rename = "Standard_A10")] + StandardA10, + #[serde(rename = "Standard_A11")] + StandardA11, + #[serde(rename = "Standard_A1_v2")] + StandardA1V2, + #[serde(rename = "Standard_A2")] + StandardA2, + #[serde(rename = "Standard_A2_v2")] + StandardA2V2, + #[serde(rename = "Standard_A2m_v2")] + StandardA2mV2, + #[serde(rename = "Standard_A3")] + StandardA3, + #[serde(rename = "Standard_A4")] + StandardA4, + #[serde(rename = "Standard_A4_v2")] + StandardA4V2, + #[serde(rename = "Standard_A4m_v2")] + StandardA4mV2, + #[serde(rename = "Standard_A5")] + StandardA5, + #[serde(rename = "Standard_A6")] + StandardA6, + #[serde(rename = "Standard_A7")] + StandardA7, + #[serde(rename = "Standard_A8")] + StandardA8, + #[serde(rename = "Standard_A8_v2")] + StandardA8V2, + #[serde(rename = "Standard_A8m_v2")] + StandardA8mV2, + #[serde(rename = "Standard_A9")] + StandardA9, + #[serde(rename = "Standard_B2ms")] + StandardB2ms, + #[serde(rename = "Standard_B2s")] + StandardB2s, + #[serde(rename = "Standard_B4ms")] + StandardB4ms, + #[serde(rename = "Standard_B8ms")] + StandardB8ms, + #[serde(rename = "Standard_D1")] + StandardD1, + #[serde(rename = "Standard_D11")] + StandardD11, + #[serde(rename = "Standard_D11_v2")] + StandardD11V2, + #[serde(rename = "Standard_D11_v2_Promo")] + StandardD11V2Promo, + #[serde(rename = "Standard_D12")] + StandardD12, + #[serde(rename = "Standard_D12_v2")] + StandardD12V2, + #[serde(rename = "Standard_D12_v2_Promo")] + StandardD12V2Promo, + #[serde(rename = "Standard_D13")] + StandardD13, + #[serde(rename = "Standard_D13_v2")] + StandardD13V2, + #[serde(rename = "Standard_D13_v2_Promo")] + StandardD13V2Promo, + #[serde(rename = "Standard_D14")] + StandardD14, + #[serde(rename = "Standard_D14_v2")] + StandardD14V2, + #[serde(rename = "Standard_D14_v2_Promo")] + StandardD14V2Promo, + #[serde(rename = "Standard_D15_v2")] + StandardD15V2, + #[serde(rename = "Standard_D16_v3")] + StandardD16V3, + #[serde(rename = "Standard_D16s_v3")] + StandardD16sV3, + #[serde(rename = "Standard_D1_v2")] + StandardD1V2, + #[serde(rename = "Standard_D2")] + StandardD2, + #[serde(rename = "Standard_D2_v2")] + StandardD2V2, + #[serde(rename = "Standard_D2_v2_Promo")] + StandardD2V2Promo, + #[serde(rename = "Standard_D2_v3")] + StandardD2V3, + #[serde(rename = "Standard_D2s_v3")] + StandardD2sV3, + #[serde(rename = "Standard_D3")] + StandardD3, + #[serde(rename = "Standard_D32_v3")] + StandardD32V3, + #[serde(rename = "Standard_D32s_v3")] + StandardD32sV3, + #[serde(rename = "Standard_D3_v2")] + StandardD3V2, + #[serde(rename = "Standard_D3_v2_Promo")] + StandardD3V2Promo, + #[serde(rename = "Standard_D4")] + StandardD4, + #[serde(rename = "Standard_D4_v2")] + StandardD4V2, + #[serde(rename = "Standard_D4_v2_Promo")] + StandardD4V2Promo, + #[serde(rename = "Standard_D4_v3")] + StandardD4V3, + #[serde(rename = "Standard_D4s_v3")] + StandardD4sV3, + #[serde(rename = "Standard_D5_v2")] + StandardD5V2, + #[serde(rename = "Standard_D5_v2_Promo")] + StandardD5V2Promo, + #[serde(rename = "Standard_D64_v3")] + StandardD64V3, + #[serde(rename = "Standard_D64s_v3")] + StandardD64sV3, + #[serde(rename = "Standard_D8_v3")] + StandardD8V3, + #[serde(rename = "Standard_D8s_v3")] + StandardD8sV3, + #[serde(rename = "Standard_DS1")] + StandardDs1, + #[serde(rename = "Standard_DS11")] + StandardDs11, + #[serde(rename = "Standard_DS11_v2")] + StandardDs11V2, + #[serde(rename = "Standard_DS11_v2_Promo")] + StandardDs11V2Promo, + #[serde(rename = "Standard_DS12")] + StandardDs12, + #[serde(rename = "Standard_DS12_v2")] + StandardDs12V2, + #[serde(rename = "Standard_DS12_v2_Promo")] + StandardDs12V2Promo, + #[serde(rename = "Standard_DS13")] + StandardDs13, + #[serde(rename = "Standard_DS13-2_v2")] + StandardDs132V2, + #[serde(rename = "Standard_DS13-4_v2")] + StandardDs134V2, + #[serde(rename = "Standard_DS13_v2")] + StandardDs13V2, + #[serde(rename = "Standard_DS13_v2_Promo")] + StandardDs13V2Promo, + #[serde(rename = "Standard_DS14")] + StandardDs14, + #[serde(rename = "Standard_DS14-4_v2")] + StandardDs144V2, + #[serde(rename = "Standard_DS14-8_v2")] + StandardDs148V2, + #[serde(rename = "Standard_DS14_v2")] + StandardDs14V2, + #[serde(rename = "Standard_DS14_v2_Promo")] + StandardDs14V2Promo, + #[serde(rename = "Standard_DS15_v2")] + StandardDs15V2, + #[serde(rename = "Standard_DS1_v2")] + StandardDs1V2, + #[serde(rename = "Standard_DS2")] + StandardDs2, + #[serde(rename = "Standard_DS2_v2")] + StandardDs2V2, + #[serde(rename = "Standard_DS2_v2_Promo")] + StandardDs2V2Promo, + #[serde(rename = "Standard_DS3")] + StandardDs3, + #[serde(rename = "Standard_DS3_v2")] + StandardDs3V2, + #[serde(rename = "Standard_DS3_v2_Promo")] + StandardDs3V2Promo, + #[serde(rename = "Standard_DS4")] + StandardDs4, + #[serde(rename = "Standard_DS4_v2")] + StandardDs4V2, + #[serde(rename = "Standard_DS4_v2_Promo")] + StandardDs4V2Promo, + #[serde(rename = "Standard_DS5_v2")] + StandardDs5V2, + #[serde(rename = "Standard_DS5_v2_Promo")] + StandardDs5V2Promo, + #[serde(rename = "Standard_E16_v3")] + StandardE16V3, + #[serde(rename = "Standard_E16s_v3")] + StandardE16sV3, + #[serde(rename = "Standard_E2_v3")] + StandardE2V3, + #[serde(rename = "Standard_E2s_v3")] + StandardE2sV3, + #[serde(rename = "Standard_E32-16s_v3")] + StandardE3216sV3, + #[serde(rename = "Standard_E32-8s_v3")] + StandardE328sV3, + #[serde(rename = "Standard_E32_v3")] + StandardE32V3, + #[serde(rename = "Standard_E32s_v3")] + StandardE32sV3, + #[serde(rename = "Standard_E4_v3")] + StandardE4V3, + #[serde(rename = "Standard_E4s_v3")] + StandardE4sV3, + #[serde(rename = "Standard_E64-16s_v3")] + StandardE6416sV3, + #[serde(rename = "Standard_E64-32s_v3")] + StandardE6432sV3, + #[serde(rename = "Standard_E64_v3")] + StandardE64V3, + #[serde(rename = "Standard_E64s_v3")] + StandardE64sV3, + #[serde(rename = "Standard_E8_v3")] + StandardE8V3, + #[serde(rename = "Standard_E8s_v3")] + StandardE8sV3, + #[serde(rename = "Standard_F1")] + StandardF1, + #[serde(rename = "Standard_F16")] + StandardF16, + #[serde(rename = "Standard_F16s")] + StandardF16s, + #[serde(rename = "Standard_F16s_v2")] + StandardF16sV2, + #[serde(rename = "Standard_F1s")] + StandardF1s, + #[serde(rename = "Standard_F2")] + StandardF2, + #[serde(rename = "Standard_F2s")] + StandardF2s, + #[serde(rename = "Standard_F2s_v2")] + StandardF2sV2, + #[serde(rename = "Standard_F32s_v2")] + StandardF32sV2, + #[serde(rename = "Standard_F4")] + StandardF4, + #[serde(rename = "Standard_F4s")] + StandardF4s, + #[serde(rename = "Standard_F4s_v2")] + StandardF4sV2, + #[serde(rename = "Standard_F64s_v2")] + StandardF64sV2, + #[serde(rename = "Standard_F72s_v2")] + StandardF72sV2, + #[serde(rename = "Standard_F8")] + StandardF8, + #[serde(rename = "Standard_F8s")] + StandardF8s, + #[serde(rename = "Standard_F8s_v2")] + StandardF8sV2, + #[serde(rename = "Standard_G1")] + StandardG1, + #[serde(rename = "Standard_G2")] + StandardG2, + #[serde(rename = "Standard_G3")] + StandardG3, + #[serde(rename = "Standard_G4")] + StandardG4, + #[serde(rename = "Standard_G5")] + StandardG5, + #[serde(rename = "Standard_GS1")] + StandardGs1, + #[serde(rename = "Standard_GS2")] + StandardGs2, + #[serde(rename = "Standard_GS3")] + StandardGs3, + #[serde(rename = "Standard_GS4")] + StandardGs4, + #[serde(rename = "Standard_GS4-4")] + StandardGs44, + #[serde(rename = "Standard_GS4-8")] + StandardGs48, + #[serde(rename = "Standard_GS5")] + StandardGs5, + #[serde(rename = "Standard_GS5-16")] + StandardGs516, + #[serde(rename = "Standard_GS5-8")] + StandardGs58, + #[serde(rename = "Standard_H16")] + StandardH16, + #[serde(rename = "Standard_H16m")] + StandardH16m, + #[serde(rename = "Standard_H16mr")] + StandardH16mr, + #[serde(rename = "Standard_H16r")] + StandardH16r, + #[serde(rename = "Standard_H8")] + StandardH8, + #[serde(rename = "Standard_H8m")] + StandardH8m, + #[serde(rename = "Standard_L16s")] + StandardL16s, + #[serde(rename = "Standard_L32s")] + StandardL32s, + #[serde(rename = "Standard_L4s")] + StandardL4s, + #[serde(rename = "Standard_L8s")] + StandardL8s, + #[serde(rename = "Standard_M128-32ms")] + StandardM12832ms, + #[serde(rename = "Standard_M128-64ms")] + StandardM12864ms, + #[serde(rename = "Standard_M128ms")] + StandardM128ms, + #[serde(rename = "Standard_M128s")] + StandardM128s, + #[serde(rename = "Standard_M64-16ms")] + StandardM6416ms, + #[serde(rename = "Standard_M64-32ms")] + StandardM6432ms, + #[serde(rename = "Standard_M64ms")] + StandardM64ms, + #[serde(rename = "Standard_M64s")] + StandardM64s, + #[serde(rename = "Standard_NC12")] + StandardNc12, + #[serde(rename = "Standard_NC12s_v2")] + StandardNc12sV2, + #[serde(rename = "Standard_NC12s_v3")] + StandardNc12sV3, + #[serde(rename = "Standard_NC24")] + StandardNc24, + #[serde(rename = "Standard_NC24r")] + StandardNc24r, + #[serde(rename = "Standard_NC24rs_v2")] + StandardNc24rsV2, + #[serde(rename = "Standard_NC24rs_v3")] + StandardNc24rsV3, + #[serde(rename = "Standard_NC24s_v2")] + StandardNc24sV2, + #[serde(rename = "Standard_NC24s_v3")] + StandardNc24sV3, + #[serde(rename = "Standard_NC6")] + StandardNc6, + #[serde(rename = "Standard_NC6s_v2")] + StandardNc6sV2, + #[serde(rename = "Standard_NC6s_v3")] + StandardNc6sV3, + #[serde(rename = "Standard_ND12s")] + StandardNd12s, + #[serde(rename = "Standard_ND24rs")] + StandardNd24rs, + #[serde(rename = "Standard_ND24s")] + StandardNd24s, + #[serde(rename = "Standard_ND6s")] + StandardNd6s, + #[serde(rename = "Standard_NV12")] + StandardNv12, + #[serde(rename = "Standard_NV24")] + StandardNv24, + #[serde(rename = "Standard_NV6")] + StandardNv6, +} +pub type ContainerServiceVnetSubnetId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceWindowsProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[serde(rename = "adminPassword")] + pub admin_password: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CredentialResults { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub kubeconfigs: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultSecretRef { + #[serde(rename = "vaultID")] + pub vault_id: String, + #[serde(rename = "secretName")] + pub secret_name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubeletConfig { + #[serde(rename = "cpuManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub cpu_manager_policy: Option, + #[serde(rename = "cpuCfsQuota", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota: Option, + #[serde(rename = "cpuCfsQuotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota_period: Option, + #[serde(rename = "imageGcHighThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_high_threshold: Option, + #[serde(rename = "imageGcLowThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_low_threshold: Option, + #[serde(rename = "topologyManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub topology_manager_policy: Option, + #[serde(rename = "allowedUnsafeSysctls", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_unsafe_sysctls: Vec, + #[serde(rename = "failSwapOn", default, skip_serializing_if = "Option::is_none")] + pub fail_swap_on: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinuxOsConfig { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sysctls: Option, + #[serde(rename = "transparentHugePageEnabled", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_enabled: Option, + #[serde(rename = "transparentHugePageDefrag", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_defrag: Option, + #[serde(rename = "swapFileSizeMB", default, skip_serializing_if = "Option::is_none")] + pub swap_file_size_mb: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCluster { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAadProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub managed: Option, + #[serde(rename = "enableAzureRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_azure_rbac: Option, + #[serde(rename = "adminGroupObjectIDs", default, skip_serializing_if = "Vec::is_empty")] + pub admin_group_object_i_ds: Vec, + #[serde(rename = "clientAppID", default, skip_serializing_if = "Option::is_none")] + pub client_app_id: Option, + #[serde(rename = "serverAppID", default, skip_serializing_if = "Option::is_none")] + pub server_app_id: Option, + #[serde(rename = "serverAppSecret", default, skip_serializing_if = "Option::is_none")] + pub server_app_secret: Option, + #[serde(rename = "tenantID", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterApiServerAccessProfile { + #[serde(rename = "authorizedIPRanges", default, skip_serializing_if = "Vec::is_empty")] + pub authorized_ip_ranges: Vec, + #[serde(rename = "enablePrivateCluster", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster: Option, + #[serde(rename = "privateDNSZone", default, skip_serializing_if = "Option::is_none")] + pub private_dns_zone: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAccessProfile { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAddonProfile { + pub enabled: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub config: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfile { + #[serde(flatten)] + pub managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties, + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfileProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "osDiskType", default, skip_serializing_if = "Option::is_none")] + pub os_disk_type: Option, + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[serde(rename = "podSubnetID", default, skip_serializing_if = "Option::is_none")] + pub pod_subnet_id: Option, + #[serde(rename = "maxPods", default, skip_serializing_if = "Option::is_none")] + pub max_pods: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "maxCount", default, skip_serializing_if = "Option::is_none")] + pub max_count: Option, + #[serde(rename = "minCount", default, skip_serializing_if = "Option::is_none")] + pub min_count: Option, + #[serde(rename = "enableAutoScaling", default, skip_serializing_if = "Option::is_none")] + pub enable_auto_scaling: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "orchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_version: Option, + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[serde(rename = "upgradeSettings", default, skip_serializing_if = "Option::is_none")] + pub upgrade_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "availabilityZones", default, skip_serializing_if = "Vec::is_empty")] + pub availability_zones: Vec, + #[serde(rename = "enableNodePublicIP", default, skip_serializing_if = "Option::is_none")] + pub enable_node_public_ip: Option, + #[serde(rename = "scaleSetPriority", default, skip_serializing_if = "Option::is_none")] + pub scale_set_priority: Option, + #[serde(rename = "scaleSetEvictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_set_eviction_policy: Option, + #[serde(rename = "spotMaxPrice", default, skip_serializing_if = "Option::is_none")] + pub spot_max_price: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "nodeLabels", default, skip_serializing_if = "Option::is_none")] + pub node_labels: Option, + #[serde(rename = "nodeTaints", default, skip_serializing_if = "Vec::is_empty")] + pub node_taints: Vec, + #[serde(rename = "proximityPlacementGroupID", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group_id: Option, + #[serde(rename = "kubeletConfig", default, skip_serializing_if = "Option::is_none")] + pub kubelet_config: Option, + #[serde(rename = "linuxOSConfig", default, skip_serializing_if = "Option::is_none")] + pub linux_os_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAutoUpgradeProfile { + #[serde(rename = "upgradeChannel", default, skip_serializing_if = "Option::is_none")] + pub upgrade_channel: Option, +} +pub mod managed_cluster_auto_upgrade_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpgradeChannel { + #[serde(rename = "rapid")] + Rapid, + #[serde(rename = "stable")] + Stable, + #[serde(rename = "patch")] + Patch, + #[serde(rename = "none")] + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod managed_cluster_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterLoadBalancerProfile { + #[serde(rename = "managedOutboundIPs", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_i_ps: Option, + #[serde(rename = "outboundIPPrefixes", default, skip_serializing_if = "Option::is_none")] + pub outbound_ip_prefixes: Option, + #[serde(rename = "outboundIPs", default, skip_serializing_if = "Option::is_none")] + pub outbound_i_ps: Option, + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[serde(rename = "allocatedOutboundPorts", default, skip_serializing_if = "Option::is_none")] + pub allocated_outbound_ports: Option, + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, +} +pub mod managed_cluster_load_balancer_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ManagedOutboundIPs { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIpPrefixes { + #[serde(rename = "publicIPPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct OutboundIPs { + #[serde(rename = "publicIPs", default, skip_serializing_if = "Vec::is_empty")] + pub public_i_ps: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentity { + pub name: String, + pub namespace: String, + pub identity: UserAssignedIdentity, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisioningInfo", default, skip_serializing_if = "Option::is_none")] + pub provisioning_info: Option, +} +pub mod managed_cluster_pod_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Assigned, + Updating, + Deleting, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ProvisioningInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityException { + pub name: String, + pub namespace: String, + #[serde(rename = "podLabels")] + pub pod_labels: serde_json::Value, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identities: Vec, + #[serde(rename = "userAssignedIdentityExceptions", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identity_exceptions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPoolUpgradeProfile { + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "osType")] + pub os_type: OsType, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[serde(rename = "maxAgentPools", default, skip_serializing_if = "Option::is_none")] + pub max_agent_pools: Option, + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[serde(rename = "dnsPrefix", default, skip_serializing_if = "Option::is_none")] + pub dns_prefix: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "privateFQDN", default, skip_serializing_if = "Option::is_none")] + pub private_fqdn: Option, + #[serde(rename = "agentPoolProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_profiles: Vec, + #[serde(rename = "linuxProfile", default, skip_serializing_if = "Option::is_none")] + pub linux_profile: Option, + #[serde(rename = "windowsProfile", default, skip_serializing_if = "Option::is_none")] + pub windows_profile: Option, + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[serde(rename = "addonProfiles", default, skip_serializing_if = "Option::is_none")] + pub addon_profiles: Option, + #[serde(rename = "podIdentityProfile", default, skip_serializing_if = "Option::is_none")] + pub pod_identity_profile: Option, + #[serde(rename = "nodeResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub node_resource_group: Option, + #[serde(rename = "enableRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_rbac: Option, + #[serde(rename = "enablePodSecurityPolicy", default, skip_serializing_if = "Option::is_none")] + pub enable_pod_security_policy: Option, + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[serde(rename = "aadProfile", default, skip_serializing_if = "Option::is_none")] + pub aad_profile: Option, + #[serde(rename = "autoUpgradeProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_profile: Option, + #[serde(rename = "autoScalerProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_scaler_profile: Option, + #[serde(rename = "apiServerAccessProfile", default, skip_serializing_if = "Option::is_none")] + pub api_server_access_profile: Option, + #[serde(rename = "diskEncryptionSetID", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "identityProfile", default, skip_serializing_if = "Option::is_none")] + pub identity_profile: Option, +} +pub mod managed_cluster_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct AutoScalerProfile { + #[serde(rename = "balance-similar-node-groups", default, skip_serializing_if = "Option::is_none")] + pub balance_similar_node_groups: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expander: Option, + #[serde(rename = "max-empty-bulk-delete", default, skip_serializing_if = "Option::is_none")] + pub max_empty_bulk_delete: Option, + #[serde(rename = "max-graceful-termination-sec", default, skip_serializing_if = "Option::is_none")] + pub max_graceful_termination_sec: Option, + #[serde(rename = "max-total-unready-percentage", default, skip_serializing_if = "Option::is_none")] + pub max_total_unready_percentage: Option, + #[serde(rename = "new-pod-scale-up-delay", default, skip_serializing_if = "Option::is_none")] + pub new_pod_scale_up_delay: Option, + #[serde(rename = "ok-total-unready-count", default, skip_serializing_if = "Option::is_none")] + pub ok_total_unready_count: Option, + #[serde(rename = "scan-interval", default, skip_serializing_if = "Option::is_none")] + pub scan_interval: Option, + #[serde(rename = "scale-down-delay-after-add", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_add: Option, + #[serde(rename = "scale-down-delay-after-delete", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_delete: Option, + #[serde(rename = "scale-down-delay-after-failure", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_failure: Option, + #[serde(rename = "scale-down-unneeded-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unneeded_time: Option, + #[serde(rename = "scale-down-unready-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unready_time: Option, + #[serde(rename = "scale-down-utilization-threshold", default, skip_serializing_if = "Option::is_none")] + pub scale_down_utilization_threshold: Option, + #[serde(rename = "skip-nodes-with-local-storage", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_local_storage: Option, + #[serde(rename = "skip-nodes-with-system-pods", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_system_pods: Option, + } + pub mod auto_scaler_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Expander { + #[serde(rename = "least-waste")] + LeastWaste, + #[serde(rename = "most-pods")] + MostPods, + #[serde(rename = "random")] + Random, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSku { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +pub mod managed_cluster_sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Paid, + Free, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterServicePrincipalProfile { + #[serde(rename = "clientId")] + pub client_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: ManagedClusterUpgradeProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfileProperties { + #[serde(rename = "controlPlaneProfile")] + pub control_plane_profile: ManagedClusterPoolUpgradeProfile, + #[serde(rename = "agentPoolProfiles")] + pub agent_pool_profiles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterWindowsProfile { + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, +} +pub mod managed_cluster_windows_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + None, + #[serde(rename = "Windows_Server")] + WindowsServer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsDiskType { + Managed, + Ephemeral, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsType { + Linux, + Windows, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValue { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValueDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrchestratorProfile { + #[serde(rename = "orchestratorType", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_type: Option, + #[serde(rename = "orchestratorVersion")] + pub orchestrator_version: String, + #[serde(rename = "isPreview", default, skip_serializing_if = "Option::is_none")] + pub is_preview: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrchestratorVersionProfile { + #[serde(rename = "orchestratorType")] + pub orchestrator_type: String, + #[serde(rename = "orchestratorVersion")] + pub orchestrator_version: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, + #[serde(rename = "isPreview", default, skip_serializing_if = "Option::is_none")] + pub is_preview: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrchestratorVersionProfileListResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: OrchestratorVersionProfileProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrchestratorVersionProfileProperties { + pub orchestrators: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +pub mod power_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + Running, + Stopped, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, +} +pub mod private_endpoint_connection_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "privateLinkServiceID", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourcesListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +pub type ProximityPlacementGroupId = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetEvictionPolicy { + Delete, + Deallocate, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetPriority { + Spot, + Regular, +} +pub type SpotMaxPrice = f64; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SysctlConfig { + #[serde(rename = "netCoreSomaxconn", default, skip_serializing_if = "Option::is_none")] + pub net_core_somaxconn: Option, + #[serde(rename = "netCoreNetdevMaxBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_core_netdev_max_backlog: Option, + #[serde(rename = "netCoreRmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_max: Option, + #[serde(rename = "netCoreWmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_max: Option, + #[serde(rename = "netCoreOptmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_optmem_max: Option, + #[serde(rename = "netIpv4TcpMaxSynBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_syn_backlog: Option, + #[serde(rename = "netIpv4TcpMaxTwBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_tw_buckets: Option, + #[serde(rename = "netIpv4TcpFinTimeout", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_fin_timeout: Option, + #[serde(rename = "netIpv4TcpKeepaliveTime", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_time: Option, + #[serde(rename = "netIpv4TcpKeepaliveProbes", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_probes: Option, + #[serde(rename = "netIpv4TcpkeepaliveIntvl", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcpkeepalive_intvl: Option, + #[serde(rename = "netIpv4TcpRmem", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_rmem: Option, + #[serde(rename = "netIpv4TcpWmem", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_wmem: Option, + #[serde(rename = "netIpv4TcpTwReuse", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_tw_reuse: Option, + #[serde(rename = "netIpv4IpLocalPortRange", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_ip_local_port_range: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh1", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh1: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh2", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh2: Option, + #[serde(rename = "netIpv4NeighDefaultGcThresh3", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh3: Option, + #[serde(rename = "netNetfilterNfConntrackMax", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_max: Option, + #[serde(rename = "netNetfilterNfConntrackBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_buckets: Option, + #[serde(rename = "fsInotifyMaxUserWatches", default, skip_serializing_if = "Option::is_none")] + pub fs_inotify_max_user_watches: Option, + #[serde(rename = "fsFileMax", default, skip_serializing_if = "Option::is_none")] + pub fs_file_max: Option, + #[serde(rename = "fsAioMaxNr", default, skip_serializing_if = "Option::is_none")] + pub fs_aio_max_nr: Option, + #[serde(rename = "fsNrOpen", default, skip_serializing_if = "Option::is_none")] + pub fs_nr_open: Option, + #[serde(rename = "kernelThreadsMax", default, skip_serializing_if = "Option::is_none")] + pub kernel_threads_max: Option, + #[serde(rename = "vmMaxMapCount", default, skip_serializing_if = "Option::is_none")] + pub vm_max_map_count: Option, + #[serde(rename = "vmSwappiness", default, skip_serializing_if = "Option::is_none")] + pub vm_swappiness: Option, + #[serde(rename = "vmVfsCachePressure", default, skip_serializing_if = "Option::is_none")] + pub vm_vfs_cache_pressure: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagsObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentity { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, +} diff --git a/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/operations.rs b/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/operations.rs new file mode 100644 index 0000000000..aef2e60379 --- /dev/null +++ b/services/mgmt/containerservice/src/profile_hybrid_2020_09_01/operations.rs @@ -0,0 +1,3454 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn agent_pools(&self) -> agent_pools::Client { + agent_pools::Client(self.clone()) + } + pub fn container_services(&self) -> container_services::Client { + container_services::Client(self.clone()) + } + pub fn managed_clusters(&self) -> managed_clusters::Client { + managed_clusters::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn resolve_private_link_service_id(&self) -> resolve_private_link_service_id::Client { + resolve_private_link_service_id::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ManagedClusters_List(#[from] managed_clusters::list::Error), + #[error(transparent)] + ManagedClusters_ListByResourceGroup(#[from] managed_clusters::list_by_resource_group::Error), + #[error(transparent)] + ManagedClusters_GetUpgradeProfile(#[from] managed_clusters::get_upgrade_profile::Error), + #[error(transparent)] + ManagedClusters_GetAccessProfile(#[from] managed_clusters::get_access_profile::Error), + #[error(transparent)] + ManagedClusters_ListClusterAdminCredentials(#[from] managed_clusters::list_cluster_admin_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterUserCredentials(#[from] managed_clusters::list_cluster_user_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterMonitoringUserCredentials(#[from] managed_clusters::list_cluster_monitoring_user_credentials::Error), + #[error(transparent)] + ManagedClusters_Get(#[from] managed_clusters::get::Error), + #[error(transparent)] + ManagedClusters_CreateOrUpdate(#[from] managed_clusters::create_or_update::Error), + #[error(transparent)] + ManagedClusters_UpdateTags(#[from] managed_clusters::update_tags::Error), + #[error(transparent)] + ManagedClusters_Delete(#[from] managed_clusters::delete::Error), + #[error(transparent)] + AgentPools_List(#[from] agent_pools::list::Error), + #[error(transparent)] + AgentPools_Get(#[from] agent_pools::get::Error), + #[error(transparent)] + AgentPools_CreateOrUpdate(#[from] agent_pools::create_or_update::Error), + #[error(transparent)] + AgentPools_Delete(#[from] agent_pools::delete::Error), + #[error(transparent)] + AgentPools_GetUpgradeProfile(#[from] agent_pools::get_upgrade_profile::Error), + #[error(transparent)] + AgentPools_GetAvailableAgentPoolVersions(#[from] agent_pools::get_available_agent_pool_versions::Error), + #[error(transparent)] + ManagedClusters_ResetServicePrincipalProfile(#[from] managed_clusters::reset_service_principal_profile::Error), + #[error(transparent)] + ManagedClusters_ResetAadProfile(#[from] managed_clusters::reset_aad_profile::Error), + #[error(transparent)] + ManagedClusters_RotateClusterCertificates(#[from] managed_clusters::rotate_cluster_certificates::Error), + #[error(transparent)] + ManagedClusters_Stop(#[from] managed_clusters::stop::Error), + #[error(transparent)] + ManagedClusters_Start(#[from] managed_clusters::start::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Update(#[from] private_endpoint_connections::update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + AgentPools_UpgradeNodeImageVersion(#[from] agent_pools::upgrade_node_image_version::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + ResolvePrivateLinkServiceId_Post(#[from] resolve_private_link_service_id::post::Error), + #[error(transparent)] + ContainerServices_ListOrchestrators(#[from] container_services::list_orchestrators::Error), + #[error(transparent)] + ContainerServices_List(#[from] container_services::list::Error), + #[error(transparent)] + ContainerServices_Get(#[from] container_services::get::Error), + #[error(transparent)] + ContainerServices_CreateOrUpdate(#[from] container_services::create_or_update::Error), + #[error(transparent)] + ContainerServices_Delete(#[from] container_services::delete::Error), + #[error(transparent)] + ContainerServices_ListByResourceGroup(#[from] container_services::list_by_resource_group::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_clusters { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of managed clusters in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists managed clusters in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets upgrade profile for a managed cluster."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets an access profile of a managed cluster."] + pub fn get_access_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + role_name: impl Into, + ) -> get_access_profile::Builder { + get_access_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + role_name: role_name.into(), + } + } + #[doc = "Gets cluster admin credential of a managed cluster."] + pub fn list_cluster_admin_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_admin_credentials::Builder { + list_cluster_admin_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets cluster user credential of a managed cluster."] + pub fn list_cluster_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_user_credentials::Builder { + list_cluster_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets cluster monitoring user credential of a managed cluster."] + pub fn list_cluster_monitoring_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_monitoring_user_credentials::Builder { + list_cluster_monitoring_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a managed cluster."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Reset Service Principal Profile of a managed cluster."] + pub fn reset_service_principal_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_service_principal_profile::Builder { + reset_service_principal_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Reset AAD Profile of a managed cluster."] + pub fn reset_aad_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_aad_profile::Builder { + reset_aad_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Rotate certificates of a managed cluster."] + pub fn rotate_cluster_certificates( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> rotate_cluster_certificates::Builder { + rotate_cluster_certificates::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Stop Managed Cluster"] + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Start Managed Cluster"] + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_access_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) role_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/accessProfiles/{}/listCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterAccessProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_admin_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterAdminCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_monitoring_user_credentials { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterMonitoringUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedCluster), + Created201(models::ManagedCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedCluster, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_service_principal_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterServicePrincipalProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetServicePrincipalProfile" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_aad_profile { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterAadProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetAADProfile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rotate_cluster_certificates { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/rotateClusterCertificates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod agent_pools { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of agent pools in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the agent pool."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Creates or updates an agent pool."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes an agent pool."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets upgrade profile for an agent pool."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets a list of supported versions for the specified agent pool."] + pub fn get_available_agent_pool_versions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_available_agent_pool_versions::Builder { + get_available_agent_pool_versions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Upgrade node image version of an agent pool to the latest."] + pub fn upgrade_node_image_version( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> upgrade_node_image_version::Builder { + upgrade_node_image_version::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + pub(crate) parameters: models::AgentPool, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_available_agent_pool_versions { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/availableAgentPoolVersions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolAvailableVersions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod upgrade_node_image_version { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeNodeImageVersion" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private endpoint connections in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the private endpoint connection."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + #[doc = "Updates a private endpoint connection."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a private endpoint connection."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private link resources in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateLinkResources" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resolve_private_link_service_id { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the private link service ID for the specified managed cluster."] + pub fn post( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> post::Builder { + post::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + } + pub mod post { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::PrivateLinkResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resolvePrivateLinkServiceId" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod container_services { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of supported orchestrators in the specified subscription."] + pub fn list_orchestrators(&self, subscription_id: impl Into, location: impl Into) -> list_orchestrators::Builder { + list_orchestrators::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + resource_type: None, + } + } + #[doc = "Gets a list of container services in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the properties of the specified container service."] + pub fn get( + &self, + resource_group_name: impl Into, + container_service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + container_service_name: container_service_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Creates or updates a container service."] + pub fn create_or_update( + &self, + resource_group_name: impl Into, + container_service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + container_service_name: container_service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Deletes the specified container service."] + pub fn delete( + &self, + resource_group_name: impl Into, + container_service_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + container_service_name: container_service_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets a list of container services in the specified resource group."] + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_orchestrators { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) resource_type: Option, + } + impl Builder { + pub fn resource_type(mut self, resource_type: impl Into) -> Self { + self.resource_type = Some(resource_type.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/locations/{}/orchestrators", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(resource_type) = &self.resource_type { + url.query_pairs_mut().append_pair("resource-type", resource_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OrchestratorVersionProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/containerServices", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContainerServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) container_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/containerServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.container_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContainerService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ContainerService), + Created201(models::ContainerService), + Accepted202(models::ContainerService), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) container_service_name: String, + pub(crate) parameters: models::ContainerService, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/containerServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.container_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContainerService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContainerService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContainerService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) container_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/containerServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.container_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/containerServices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContainerServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/cosmosdb/src/package_preview_2021_10/models.rs b/services/mgmt/cosmosdb/src/package_preview_2021_10/models.rs index 29ceeb2c52..cbcc1855a5 100644 --- a/services/mgmt/cosmosdb/src/package_preview_2021_10/models.rs +++ b/services/mgmt/cosmosdb/src/package_preview_2021_10/models.rs @@ -337,6 +337,8 @@ pub struct ClientEncryptionKeyGetResults { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClientEncryptionKeyResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, #[serde(rename = "encryptionAlgorithm", default, skip_serializing_if = "Option::is_none")] pub encryption_algorithm: Option, #[serde(rename = "wrappedDataEncryptionKey", default, skip_serializing_if = "Option::is_none")] diff --git a/services/mgmt/cosmosdb/src/package_preview_2021_10/operations.rs b/services/mgmt/cosmosdb/src/package_preview_2021_10/operations.rs index 5d11a68b96..964888ed8c 100644 --- a/services/mgmt/cosmosdb/src/package_preview_2021_10/operations.rs +++ b/services/mgmt/cosmosdb/src/package_preview_2021_10/operations.rs @@ -5586,6 +5586,11 @@ pub mod sql_resources { } pub mod create_update_client_encryption_key { use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ClientEncryptionKeyGetResults), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("Unexpected HTTP status code {}", status_code)] @@ -5616,9 +5621,7 @@ pub mod sql_resources { pub(crate) create_update_client_encryption_key_parameters: models::ClientEncryptionKeyCreateUpdateParameters, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/clientEncryptionKeys/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . client_encryption_key_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; @@ -5638,11 +5641,12 @@ pub mod sql_resources { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ClientEncryptionKeyGetResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Ok200(rsp_value)) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; diff --git a/services/mgmt/costmanagement/src/package_2021_10/models.rs b/services/mgmt/costmanagement/src/package_2021_10/models.rs index 2a00e9b874..822cfe3684 100644 --- a/services/mgmt/costmanagement/src/package_2021_10/models.rs +++ b/services/mgmt/costmanagement/src/package_2021_10/models.rs @@ -122,6 +122,18 @@ pub mod alert_properties { pub contact_roles: Vec, #[serde(rename = "overridingAlert", default, skip_serializing_if = "Option::is_none")] pub overriding_alert: Option, + #[serde(rename = "departmentName", default, skip_serializing_if = "Option::is_none")] + pub department_name: Option, + #[serde(rename = "companyName", default, skip_serializing_if = "Option::is_none")] + pub company_name: Option, + #[serde(rename = "enrollmentNumber", default, skip_serializing_if = "Option::is_none")] + pub enrollment_number: Option, + #[serde(rename = "enrollmentStartDate", default, skip_serializing_if = "Option::is_none")] + pub enrollment_start_date: Option, + #[serde(rename = "enrollmentEndDate", default, skip_serializing_if = "Option::is_none")] + pub enrollment_end_date: Option, + #[serde(rename = "invoicingThreshold", default, skip_serializing_if = "Option::is_none")] + pub invoicing_threshold: Option, } pub mod details { use super::*; diff --git a/services/mgmt/datafactory/src/package_2018_06/models.rs b/services/mgmt/datafactory/src/package_2018_06/models.rs index 2480edce15..6d7e8718e1 100644 --- a/services/mgmt/datafactory/src/package_2018_06/models.rs +++ b/services/mgmt/datafactory/src/package_2018_06/models.rs @@ -1005,6 +1005,10 @@ pub struct AzureDatabricksDetltaLakeLinkedServiceTypeProperties { pub cluster_id: Option, #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] pub encrypted_credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "workspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub workspace_resource_id: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureDatabricksLinkedService { @@ -1749,7 +1753,7 @@ pub struct BinarySource { #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] pub format_settings: Option, } -pub type BlobEventTypes = Vec; +pub type BlobEventTypeArray = Vec; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BlobEventsTrigger { #[serde(flatten)] @@ -1767,7 +1771,7 @@ pub mod blob_events_trigger { pub blob_path_ends_with: Option, #[serde(rename = "ignoreEmptyBlobs", default, skip_serializing_if = "Option::is_none")] pub ignore_empty_blobs: Option, - pub events: BlobEventTypes, + pub events: BlobEventTypeArray, pub scope: String, } } @@ -2217,6 +2221,8 @@ pub struct CosmosDbLinkedServiceTypeProperties { pub connection_mode: Option, #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] pub encrypted_credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, } pub mod cosmos_db_linked_service_type_properties { use super::*; @@ -2490,8 +2496,8 @@ pub struct DwCopyCommandSettings { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DataFlow { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, + #[serde(rename = "type")] + pub type_: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Vec::is_empty")] @@ -3259,6 +3265,8 @@ pub struct DynamicsLinkedServiceTypeProperties { pub service_principal_credential: Option, #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] pub encrypted_credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DynamicsSink { @@ -3959,12 +3967,14 @@ pub struct GoogleAdWordsLinkedService { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct GoogleAdWordsLinkedServiceTypeProperties { - #[serde(rename = "clientCustomerID")] - pub client_customer_id: serde_json::Value, - #[serde(rename = "developerToken")] - pub developer_token: SecretBase, - #[serde(rename = "authenticationType")] - pub authentication_type: google_ad_words_linked_service_type_properties::AuthenticationType, + #[serde(rename = "connectionProperties", default, skip_serializing_if = "Option::is_none")] + pub connection_properties: Option, + #[serde(rename = "clientCustomerID", default, skip_serializing_if = "Option::is_none")] + pub client_customer_id: Option, + #[serde(rename = "developerToken", default, skip_serializing_if = "Option::is_none")] + pub developer_token: Option, + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, #[serde(rename = "refreshToken", default, skip_serializing_if = "Option::is_none")] pub refresh_token: Option, #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] @@ -5316,6 +5326,8 @@ pub struct LinkedIntegrationRuntimeRbacAuthorization { pub linked_integration_runtime_type: LinkedIntegrationRuntimeType, #[serde(rename = "resourceId")] pub resource_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct LinkedIntegrationRuntimeRequest { diff --git a/services/mgmt/dataprotection/Cargo.toml b/services/mgmt/dataprotection/Cargo.toml index 194b86bb9f..e0facc8bfc 100644 --- a/services/mgmt/dataprotection/Cargo.toml +++ b/services/mgmt/dataprotection/Cargo.toml @@ -28,3 +28,4 @@ no-default-version = [] "package-2021-01" = [] "package-2021-02-preview" = [] "package-2021-06-preview" = [] +"package-2021-12-preview" = [] diff --git a/services/mgmt/dataprotection/src/lib.rs b/services/mgmt/dataprotection/src/lib.rs index 8df1634799..3a387cfda3 100644 --- a/services/mgmt/dataprotection/src/lib.rs +++ b/services/mgmt/dataprotection/src/lib.rs @@ -23,3 +23,7 @@ pub use package_2021_02_preview::{models, operations, operations::Client, operat pub mod package_2021_06_preview; #[cfg(all(feature = "package-2021-06-preview", not(feature = "no-default-version")))] pub use package_2021_06_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-12-preview")] +pub mod package_2021_12_preview; +#[cfg(all(feature = "package-2021-12-preview", not(feature = "no-default-version")))] +pub use package_2021_12_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/dataprotection/src/package_2021_12_preview/mod.rs b/services/mgmt/dataprotection/src/package_2021_12_preview/mod.rs new file mode 100644 index 0000000000..40526a463d --- /dev/null +++ b/services/mgmt/dataprotection/src/package_2021_12_preview/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-12-01-preview"; diff --git a/services/mgmt/dataprotection/src/package_2021_12_preview/models.rs b/services/mgmt/dataprotection/src/package_2021_12_preview/models.rs new file mode 100644 index 0000000000..e541c7e00a --- /dev/null +++ b/services/mgmt/dataprotection/src/package_2021_12_preview/models.rs @@ -0,0 +1,1293 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AbsoluteDeleteOption { + #[serde(flatten)] + pub delete_option: DeleteOption, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdHocBackupRuleOptions { + #[serde(rename = "ruleName")] + pub rule_name: String, + #[serde(rename = "triggerOption")] + pub trigger_option: AdhocBackupTriggerOption, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdhocBackupTriggerOption { + #[serde(rename = "retentionTagOverride", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_override: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdhocBasedTaggingCriteria { + #[serde(rename = "tagInfo", default, skip_serializing_if = "Option::is_none")] + pub tag_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdhocBasedTriggerContext { + #[serde(flatten)] + pub trigger_context: TriggerContext, + #[serde(rename = "taggingCriteria")] + pub tagging_criteria: AdhocBasedTaggingCriteria, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthCredentials { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupDiscreteRecoveryPoint { + #[serde(flatten)] + pub azure_backup_recovery_point: AzureBackupRecoveryPoint, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "recoveryPointDataStoresDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_data_stores_details: Vec, + #[serde(rename = "recoveryPointTime")] + pub recovery_point_time: String, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "policyVersion", default, skip_serializing_if = "Option::is_none")] + pub policy_version: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "retentionTagName", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_name: Option, + #[serde(rename = "retentionTagVersion", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupFindRestorableTimeRangesRequest { + #[serde(rename = "sourceDataStoreType")] + pub source_data_store_type: azure_backup_find_restorable_time_ranges_request::SourceDataStoreType, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +pub mod azure_backup_find_restorable_time_ranges_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceDataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupFindRestorableTimeRangesRequestResource { + #[serde(flatten)] + pub dpp_worker_request: DppWorkerRequest, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupFindRestorableTimeRangesResponse { + #[serde(rename = "restorableTimeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub restorable_time_ranges: Vec, + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupFindRestorableTimeRangesResponseResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupJob { + #[serde(rename = "activityID")] + pub activity_id: String, + #[serde(rename = "backupInstanceFriendlyName")] + pub backup_instance_friendly_name: String, + #[serde(rename = "backupInstanceId", default, skip_serializing_if = "Option::is_none")] + pub backup_instance_id: Option, + #[serde(rename = "dataSourceId")] + pub data_source_id: String, + #[serde(rename = "dataSourceLocation")] + pub data_source_location: String, + #[serde(rename = "dataSourceName")] + pub data_source_name: String, + #[serde(rename = "dataSourceSetName", default, skip_serializing_if = "Option::is_none")] + pub data_source_set_name: Option, + #[serde(rename = "dataSourceType")] + pub data_source_type: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "isUserTriggered")] + pub is_user_triggered: bool, + pub operation: String, + #[serde(rename = "operationCategory")] + pub operation_category: String, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "progressEnabled")] + pub progress_enabled: bool, + #[serde(rename = "progressUrl", default, skip_serializing_if = "Option::is_none")] + pub progress_url: Option, + #[serde(rename = "restoreType", default, skip_serializing_if = "Option::is_none")] + pub restore_type: Option, + #[serde(rename = "sourceResourceGroup")] + pub source_resource_group: String, + #[serde(rename = "sourceSubscriptionID")] + pub source_subscription_id: String, + #[serde(rename = "startTime")] + pub start_time: String, + pub status: String, + #[serde(rename = "subscriptionId")] + pub subscription_id: String, + #[serde(rename = "supportedActions")] + pub supported_actions: Vec, + #[serde(rename = "vaultName")] + pub vault_name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(rename = "sourceDataStoreName", default, skip_serializing_if = "Option::is_none")] + pub source_data_store_name: Option, + #[serde(rename = "destinationDataStoreName", default, skip_serializing_if = "Option::is_none")] + pub destination_data_store_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupJobResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupJobResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupParams { + #[serde(flatten)] + pub backup_parameters: BackupParameters, + #[serde(rename = "backupType")] + pub backup_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryPoint { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryPointBasedRestoreRequest { + #[serde(flatten)] + pub azure_backup_restore_request: AzureBackupRestoreRequest, + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryPointResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryPointResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryTimeBasedRestoreRequest { + #[serde(flatten)] + pub azure_backup_restore_request: AzureBackupRestoreRequest, + #[serde(rename = "recoveryPointTime")] + pub recovery_point_time: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRehydrationRequest { + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, + #[serde(rename = "rehydrationPriority", default, skip_serializing_if = "Option::is_none")] + pub rehydration_priority: Option, + #[serde(rename = "rehydrationRetentionDuration")] + pub rehydration_retention_duration: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRestoreRequest { + #[serde(rename = "objectType")] + pub object_type: String, + #[serde(rename = "restoreTargetInfo")] + pub restore_target_info: RestoreTargetInfoBase, + #[serde(rename = "sourceDataStoreType")] + pub source_data_store_type: azure_backup_restore_request::SourceDataStoreType, +} +pub mod azure_backup_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceDataStoreType { + ArchiveStore, + SnapshotStore, + VaultStore, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRestoreWithRehydrationRequest { + #[serde(flatten)] + pub azure_backup_recovery_point_based_restore_request: AzureBackupRecoveryPointBasedRestoreRequest, + #[serde(rename = "rehydrationPriority")] + pub rehydration_priority: RehydrationPriority, + #[serde(rename = "rehydrationRetentionDuration")] + pub rehydration_retention_duration: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRule { + #[serde(flatten)] + pub base_policy_rule: BasePolicyRule, + #[serde(rename = "backupParameters", default, skip_serializing_if = "Option::is_none")] + pub backup_parameters: Option, + #[serde(rename = "dataStore")] + pub data_store: DataStoreInfoBase, + pub trigger: TriggerContext, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureOperationalStoreParameters { + #[serde(flatten)] + pub data_store_parameters: DataStoreParameters, + #[serde(rename = "resourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub resource_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureRetentionRule { + #[serde(flatten)] + pub base_policy_rule: BasePolicyRule, + #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")] + pub is_default: Option, + pub lifecycles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupCriteria { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupInstance { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "dataSourceInfo")] + pub data_source_info: Datasource, + #[serde(rename = "dataSourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub data_source_set_info: Option, + #[serde(rename = "policyInfo")] + pub policy_info: PolicyInfo, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "currentProtectionState", default, skip_serializing_if = "Option::is_none")] + pub current_protection_state: Option, + #[serde(rename = "protectionErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub protection_error_details: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, + #[serde(rename = "objectType")] + pub object_type: String, +} +pub mod backup_instance { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CurrentProtectionState { + Invalid, + NotProtected, + ConfiguringProtection, + ProtectionConfigured, + BackupSchedulesSuspended, + RetentionSchedulesSuspended, + ProtectionStopped, + ProtectionError, + ConfiguringProtectionFailed, + SoftDeleting, + SoftDeleted, + UpdatingProtection, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupInstanceResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupInstanceResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupParameters { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicy { + #[serde(flatten)] + pub base_backup_policy: BaseBackupPolicy, + #[serde(rename = "policyRules")] + pub policy_rules: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupSchedule { + #[serde(rename = "repeatingTimeIntervals")] + pub repeating_time_intervals: Vec, + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupVault { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "resourceMoveState", default, skip_serializing_if = "Option::is_none")] + pub resource_move_state: Option, + #[serde(rename = "resourceMoveDetails", default, skip_serializing_if = "Option::is_none")] + pub resource_move_details: Option, + #[serde(rename = "storageSettings")] + pub storage_settings: Vec, +} +pub mod backup_vault { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Failed, + Provisioning, + Succeeded, + Unknown, + Updating, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceMoveState { + Unknown, + InProgress, + PrepareFailed, + CommitFailed, + Failed, + PrepareTimedout, + CommitTimedout, + CriticalFailure, + PartialSuccess, + MoveSucceeded, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupVaultResource { + #[serde(flatten)] + pub dpp_tracked_resource: DppTrackedResource, + pub properties: BackupVault, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupVaultResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BaseBackupPolicy { + #[serde(rename = "datasourceTypes")] + pub datasource_types: Vec, + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BaseBackupPolicyResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BaseBackupPolicyResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BasePolicyRule { + pub name: String, + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForLogSpecification { + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForProperties { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForServiceSpecification { + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryResponse { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryValueForSingleApi { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyOnExpiryOption { + #[serde(flatten)] + pub copy_option: CopyOption, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyOption { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomCopyOption { + #[serde(flatten)] + pub copy_option: CopyOption, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataStoreInfoBase { + #[serde(rename = "dataStoreType")] + pub data_store_type: data_store_info_base::DataStoreType, + #[serde(rename = "objectType")] + pub object_type: String, +} +pub mod data_store_info_base { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataStoreParameters { + #[serde(rename = "objectType")] + pub object_type: String, + #[serde(rename = "dataStoreType")] + pub data_store_type: data_store_parameters::DataStoreType, +} +pub mod data_store_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Datasource { + #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] + pub datasource_type: Option, + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[serde(rename = "resourceID")] + pub resource_id: String, + #[serde(rename = "resourceLocation", default, skip_serializing_if = "Option::is_none")] + pub resource_location: Option, + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasourceSet { + #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] + pub datasource_type: Option, + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[serde(rename = "resourceID")] + pub resource_id: String, + #[serde(rename = "resourceLocation", default, skip_serializing_if = "Option::is_none")] + pub resource_location: Option, + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Day { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub date: Option, + #[serde(rename = "isLast", default, skip_serializing_if = "Option::is_none")] + pub is_last: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeleteOption { + pub duration: String, + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DppBaseResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DppBaseResourceList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DppIdentityDetails { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DppResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DppResourceList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DppTrackedResource { + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DppTrackedResourceList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DppWorkerRequest { + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[serde(rename = "supportedGroupVersions", default, skip_serializing_if = "Vec::is_empty")] + pub supported_group_versions: Vec, + #[serde(rename = "cultureInfo", default, skip_serializing_if = "Option::is_none")] + pub culture_info: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[serde(rename = "httpMethod", default, skip_serializing_if = "Option::is_none")] + pub http_method: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Error { + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportJobsResult { + #[serde(rename = "blobUrl", default, skip_serializing_if = "Option::is_none")] + pub blob_url: Option, + #[serde(rename = "blobSasKey", default, skip_serializing_if = "Option::is_none")] + pub blob_sas_key: Option, + #[serde(rename = "excelFileBlobUrl", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_url: Option, + #[serde(rename = "excelFileBlobSasKey", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_sas_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationRequest { + #[serde(flatten)] + pub feature_validation_request_base: FeatureValidationRequestBase, + #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] + pub feature_type: Option, + #[serde(rename = "featureName", default, skip_serializing_if = "Option::is_none")] + pub feature_name: Option, +} +pub mod feature_validation_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FeatureType { + Invalid, + DataSourceType, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationRequestBase { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationResponse { + #[serde(flatten)] + pub feature_validation_response_base: FeatureValidationResponseBase, + #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] + pub feature_type: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub features: Vec, +} +pub mod feature_validation_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FeatureType { + Invalid, + DataSourceType, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationResponseBase { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImmediateCopyOption { + #[serde(flatten)] + pub copy_option: CopyOption, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InnerError { + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Option::is_none")] + pub additional_info: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(rename = "embeddedInnerError", default, skip_serializing_if = "Option::is_none")] + pub embedded_inner_error: Box>, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ItemLevelRestoreCriteria { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ItemLevelRestoreTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[serde(rename = "restoreCriteria")] + pub restore_criteria: Vec, + #[serde(rename = "datasourceInfo")] + pub datasource_info: Datasource, + #[serde(rename = "datasourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub datasource_set_info: Option, + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobExtendedInfo { + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, + #[serde(rename = "backupInstanceState", default, skip_serializing_if = "Option::is_none")] + pub backup_instance_state: Option, + #[serde(rename = "dataTransferredInBytes", default, skip_serializing_if = "Option::is_none")] + pub data_transferred_in_bytes: Option, + #[serde(rename = "recoveryDestination", default, skip_serializing_if = "Option::is_none")] + pub recovery_destination: Option, + #[serde(rename = "sourceRecoverPoint", default, skip_serializing_if = "Option::is_none")] + pub source_recover_point: Option, + #[serde(rename = "subTasks", default, skip_serializing_if = "Vec::is_empty")] + pub sub_tasks: Vec, + #[serde(rename = "targetRecoverPoint", default, skip_serializing_if = "Option::is_none")] + pub target_recover_point: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobSubTask { + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, + #[serde(rename = "taskId")] + pub task_id: i32, + #[serde(rename = "taskName")] + pub task_name: String, + #[serde(rename = "taskProgress", default, skip_serializing_if = "Option::is_none")] + pub task_progress: Option, + #[serde(rename = "taskStatus")] + pub task_status: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesPvRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "storageClassName", default, skip_serializing_if = "Option::is_none")] + pub storage_class_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesStorageClassRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[serde(rename = "selectedStorageClassName", default, skip_serializing_if = "Option::is_none")] + pub selected_storage_class_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provisioner: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationExtendedInfo { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationJobExtendedInfo { + #[serde(flatten)] + pub operation_extended_info: OperationExtendedInfo, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResource { + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PatchResourceRequestInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyInfo { + #[serde(rename = "policyId")] + pub policy_id: String, + #[serde(rename = "policyVersion", default, skip_serializing_if = "Option::is_none")] + pub policy_version: Option, + #[serde(rename = "policyParameters", default, skip_serializing_if = "Option::is_none")] + pub policy_parameters: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyParameters { + #[serde(rename = "dataStoreParametersList", default, skip_serializing_if = "Vec::is_empty")] + pub data_store_parameters_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionStatusDetails { + #[serde(rename = "errorDetails", default, skip_serializing_if = "Option::is_none")] + pub error_details: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod protection_status_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + ConfiguringProtection, + ConfiguringProtectionFailed, + ProtectionConfigured, + ProtectionStopped, + SoftDeleted, + SoftDeleting, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RangeBasedItemLevelRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[serde(rename = "minMatchingValue", default, skip_serializing_if = "Option::is_none")] + pub min_matching_value: Option, + #[serde(rename = "maxMatchingValue", default, skip_serializing_if = "Option::is_none")] + pub max_matching_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointDataStoreDetails { + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[serde(rename = "expiryTime", default, skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "metaData", default, skip_serializing_if = "Option::is_none")] + pub meta_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visible: Option, + #[serde(rename = "rehydrationExpiryTime", default, skip_serializing_if = "Option::is_none")] + pub rehydration_expiry_time: Option, + #[serde(rename = "rehydrationStatus", default, skip_serializing_if = "Option::is_none")] + pub rehydration_status: Option, +} +pub mod recovery_point_data_store_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RehydrationStatus { + #[serde(rename = "CREATE_IN_PROGRESS")] + CreateInProgress, + #[serde(rename = "COMPLETED")] + Completed, + #[serde(rename = "DELETE_IN_PROGRESS")] + DeleteInProgress, + #[serde(rename = "DELETED")] + Deleted, + #[serde(rename = "FAILED")] + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointsFilters { + #[serde(rename = "restorePointDataStoreId", default, skip_serializing_if = "Option::is_none")] + pub restore_point_data_store_id: Option, + #[serde(rename = "isVisible", default, skip_serializing_if = "Option::is_none")] + pub is_visible: Option, + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "restorePointState", default, skip_serializing_if = "Option::is_none")] + pub restore_point_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RehydrationPriority { + Invalid, + High, + Standard, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGuard { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "allowAutoApprovals", default, skip_serializing_if = "Option::is_none")] + pub allow_auto_approvals: Option, + #[serde(rename = "resourceGuardOperations", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operations: Vec, + #[serde(rename = "vaultCriticalOperationExclusionList", default, skip_serializing_if = "Vec::is_empty")] + pub vault_critical_operation_exclusion_list: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +pub mod resource_guard { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Failed, + Provisioning, + Succeeded, + Unknown, + Updating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGuardOperation { + #[serde(rename = "vaultCriticalOperation", default, skip_serializing_if = "Option::is_none")] + pub vault_critical_operation: Option, + #[serde(rename = "requestResourceType", default, skip_serializing_if = "Option::is_none")] + pub request_resource_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGuardResource { + #[serde(flatten)] + pub dpp_tracked_resource: DppTrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGuardResourceList { + #[serde(flatten)] + pub dpp_tracked_resource_list: DppTrackedResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceMoveDetails { + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[serde(rename = "completionTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub completion_time_utc: Option, + #[serde(rename = "sourceResourcePath", default, skip_serializing_if = "Option::is_none")] + pub source_resource_path: Option, + #[serde(rename = "targetResourcePath", default, skip_serializing_if = "Option::is_none")] + pub target_resource_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorableTimeRange { + #[serde(rename = "startTime")] + pub start_time: String, + #[serde(rename = "endTime")] + pub end_time: String, + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreFilesTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[serde(rename = "targetDetails")] + pub target_details: TargetDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreJobRecoveryPointDetails { + #[serde(rename = "recoveryPointID", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[serde(rename = "datasourceInfo")] + pub datasource_info: Datasource, + #[serde(rename = "datasourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub datasource_set_info: Option, + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreTargetInfoBase { + #[serde(rename = "objectType")] + pub object_type: String, + #[serde(rename = "recoveryOption")] + pub recovery_option: restore_target_info_base::RecoveryOption, + #[serde(rename = "restoreLocation", default, skip_serializing_if = "Option::is_none")] + pub restore_location: Option, +} +pub mod restore_target_info_base { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryOption { + FailIfExists, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionTag { + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "tagName")] + pub tag_name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleBasedBackupCriteria { + #[serde(flatten)] + pub backup_criteria: BackupCriteria, + #[serde(rename = "absoluteCriteria", default, skip_serializing_if = "Vec::is_empty")] + pub absolute_criteria: Vec, + #[serde(rename = "daysOfMonth", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_month: Vec, + #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_week: Vec, + #[serde(rename = "monthsOfYear", default, skip_serializing_if = "Vec::is_empty")] + pub months_of_year: Vec, + #[serde(rename = "scheduleTimes", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_times: Vec, + #[serde(rename = "weeksOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] + pub weeks_of_the_month: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleBasedTriggerContext { + #[serde(flatten)] + pub trigger_context: TriggerContext, + pub schedule: BackupSchedule, + #[serde(rename = "taggingCriteria")] + pub tagging_criteria: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretStoreBasedAuthCredentials { + #[serde(flatten)] + pub auth_credentials: AuthCredentials, + #[serde(rename = "secretStoreResource", default, skip_serializing_if = "Option::is_none")] + pub secret_store_resource: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretStoreResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, + #[serde(rename = "secretStoreType")] + pub secret_store_type: secret_store_resource::SecretStoreType, +} +pub mod secret_store_resource { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SecretStoreType { + Invalid, + AzureKeyVault, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceLifeCycle { + #[serde(rename = "deleteAfter")] + pub delete_after: DeleteOption, + #[serde(rename = "sourceDataStore")] + pub source_data_store: DataStoreInfoBase, + #[serde(rename = "targetDataStoreCopySettings", default, skip_serializing_if = "Vec::is_empty")] + pub target_data_store_copy_settings: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageSetting { + #[serde(rename = "datastoreType", default, skip_serializing_if = "Option::is_none")] + pub datastore_type: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod storage_setting { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DatastoreType { + ArchiveStore, + SnapshotStore, + VaultStore, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + GeoRedundant, + LocallyRedundant, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedFeature { + #[serde(rename = "featureName", default, skip_serializing_if = "Option::is_none")] + pub feature_name: Option, + #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] + pub support_status: Option, + #[serde(rename = "exposureControlledFeatures", default, skip_serializing_if = "Vec::is_empty")] + pub exposure_controlled_features: Vec, +} +pub mod supported_feature { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SupportStatus { + Invalid, + NotSupported, + AlphaPreview, + PrivatePreview, + PublicPreview, + GenerallyAvailable, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaggingCriteria { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub criteria: Vec, + #[serde(rename = "isDefault")] + pub is_default: bool, + #[serde(rename = "taggingPriority")] + pub tagging_priority: i64, + #[serde(rename = "tagInfo")] + pub tag_info: RetentionTag, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetCopySetting { + #[serde(rename = "copyAfter")] + pub copy_after: CopyOption, + #[serde(rename = "dataStore")] + pub data_store: DataStoreInfoBase, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetDetails { + #[serde(rename = "filePrefix")] + pub file_prefix: String, + #[serde(rename = "restoreTargetLocationType")] + pub restore_target_location_type: target_details::RestoreTargetLocationType, + pub url: String, +} +pub mod target_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestoreTargetLocationType { + Invalid, + AzureBlobs, + AzureFiles, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerBackupRequest { + #[serde(rename = "backupRuleOptions")] + pub backup_rule_options: AdHocBackupRuleOptions, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerContext { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserFacingError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "innerError", default, skip_serializing_if = "Option::is_none")] + pub inner_error: Option, + #[serde(rename = "isRetryable", default, skip_serializing_if = "Option::is_none")] + pub is_retryable: Option, + #[serde(rename = "isUserError", default, skip_serializing_if = "Option::is_none")] + pub is_user_error: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Vec::is_empty")] + pub recommended_action: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateForBackupRequest { + #[serde(rename = "backupInstance")] + pub backup_instance: BackupInstance, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateRestoreRequestObject { + #[serde(rename = "restoreRequestObject")] + pub restore_request_object: AzureBackupRestoreRequest, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/dataprotection/src/package_2021_12_preview/operations.rs b/services/mgmt/dataprotection/src/package_2021_12_preview/operations.rs new file mode 100644 index 0000000000..93c7654fb9 --- /dev/null +++ b/services/mgmt/dataprotection/src/package_2021_12_preview/operations.rs @@ -0,0 +1,4930 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn backup_instances(&self) -> backup_instances::Client { + backup_instances::Client(self.clone()) + } + pub fn backup_policies(&self) -> backup_policies::Client { + backup_policies::Client(self.clone()) + } + pub fn backup_vault_operation_results(&self) -> backup_vault_operation_results::Client { + backup_vault_operation_results::Client(self.clone()) + } + pub fn backup_vaults(&self) -> backup_vaults::Client { + backup_vaults::Client(self.clone()) + } + pub fn data_protection(&self) -> data_protection::Client { + data_protection::Client(self.clone()) + } + pub fn data_protection_operations(&self) -> data_protection_operations::Client { + data_protection_operations::Client(self.clone()) + } + pub fn export_jobs(&self) -> export_jobs::Client { + export_jobs::Client(self.clone()) + } + pub fn export_jobs_operation_result(&self) -> export_jobs_operation_result::Client { + export_jobs_operation_result::Client(self.clone()) + } + pub fn jobs(&self) -> jobs::Client { + jobs::Client(self.clone()) + } + pub fn operation_result(&self) -> operation_result::Client { + operation_result::Client(self.clone()) + } + pub fn operation_status(&self) -> operation_status::Client { + operation_status::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn resource_guards(&self) -> resource_guards::Client { + resource_guards::Client(self.clone()) + } + pub fn restorable_time_ranges(&self) -> restorable_time_ranges::Client { + restorable_time_ranges::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + BackupVaults_GetInSubscription(#[from] backup_vaults::get_in_subscription::Error), + #[error(transparent)] + OperationResult_Get(#[from] operation_result::get::Error), + #[error(transparent)] + OperationStatus_Get(#[from] operation_status::get::Error), + #[error(transparent)] + BackupVaults_GetInResourceGroup(#[from] backup_vaults::get_in_resource_group::Error), + #[error(transparent)] + BackupVaults_Get(#[from] backup_vaults::get::Error), + #[error(transparent)] + BackupVaults_CreateOrUpdate(#[from] backup_vaults::create_or_update::Error), + #[error(transparent)] + BackupVaults_Update(#[from] backup_vaults::update::Error), + #[error(transparent)] + BackupVaults_Delete(#[from] backup_vaults::delete::Error), + #[error(transparent)] + BackupVaultOperationResults_Get(#[from] backup_vault_operation_results::get::Error), + #[error(transparent)] + BackupVaults_CheckNameAvailability(#[from] backup_vaults::check_name_availability::Error), + #[error(transparent)] + DataProtection_CheckFeatureSupport(#[from] data_protection::check_feature_support::Error), + #[error(transparent)] + DataProtectionOperations_List(#[from] data_protection_operations::list::Error), + #[error(transparent)] + BackupPolicies_List(#[from] backup_policies::list::Error), + #[error(transparent)] + BackupPolicies_Get(#[from] backup_policies::get::Error), + #[error(transparent)] + BackupPolicies_CreateOrUpdate(#[from] backup_policies::create_or_update::Error), + #[error(transparent)] + BackupPolicies_Delete(#[from] backup_policies::delete::Error), + #[error(transparent)] + BackupInstances_List(#[from] backup_instances::list::Error), + #[error(transparent)] + BackupInstances_Get(#[from] backup_instances::get::Error), + #[error(transparent)] + BackupInstances_CreateOrUpdate(#[from] backup_instances::create_or_update::Error), + #[error(transparent)] + BackupInstances_Delete(#[from] backup_instances::delete::Error), + #[error(transparent)] + BackupInstances_AdhocBackup(#[from] backup_instances::adhoc_backup::Error), + #[error(transparent)] + BackupInstances_ValidateForBackup(#[from] backup_instances::validate_for_backup::Error), + #[error(transparent)] + RecoveryPoints_List(#[from] recovery_points::list::Error), + #[error(transparent)] + RecoveryPoints_Get(#[from] recovery_points::get::Error), + #[error(transparent)] + BackupInstances_TriggerRehydrate(#[from] backup_instances::trigger_rehydrate::Error), + #[error(transparent)] + BackupInstances_TriggerRestore(#[from] backup_instances::trigger_restore::Error), + #[error(transparent)] + BackupInstances_ValidateForRestore(#[from] backup_instances::validate_for_restore::Error), + #[error(transparent)] + Jobs_List(#[from] jobs::list::Error), + #[error(transparent)] + RestorableTimeRanges_Find(#[from] restorable_time_ranges::find::Error), + #[error(transparent)] + Jobs_Get(#[from] jobs::get::Error), + #[error(transparent)] + ExportJobs_Trigger(#[from] export_jobs::trigger::Error), + #[error(transparent)] + ExportJobsOperationResult_Get(#[from] export_jobs_operation_result::get::Error), + #[error(transparent)] + ResourceGuards_GetResourcesInSubscription(#[from] resource_guards::get_resources_in_subscription::Error), + #[error(transparent)] + ResourceGuards_GetResourcesInResourceGroup(#[from] resource_guards::get_resources_in_resource_group::Error), + #[error(transparent)] + ResourceGuards_Get(#[from] resource_guards::get::Error), + #[error(transparent)] + ResourceGuards_Put(#[from] resource_guards::put::Error), + #[error(transparent)] + ResourceGuards_Patch(#[from] resource_guards::patch::Error), + #[error(transparent)] + ResourceGuards_Delete(#[from] resource_guards::delete::Error), + #[error(transparent)] + ResourceGuards_GetDisableSoftDeleteRequestsObjects(#[from] resource_guards::get_disable_soft_delete_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDeleteResourceGuardProxyRequestsObjects( + #[from] resource_guards::get_delete_resource_guard_proxy_requests_objects::Error, + ), + #[error(transparent)] + ResourceGuards_GetBackupSecurityPinRequestsObjects(#[from] resource_guards::get_backup_security_pin_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDeleteProtectedItemRequestsObjects(#[from] resource_guards::get_delete_protected_item_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetUpdateProtectionPolicyRequestsObjects(#[from] resource_guards::get_update_protection_policy_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetUpdateProtectedItemRequestsObjects(#[from] resource_guards::get_update_protected_item_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDefaultDisableSoftDeleteRequestsObject( + #[from] resource_guards::get_default_disable_soft_delete_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultDeleteResourceGuardProxyRequestsObject( + #[from] resource_guards::get_default_delete_resource_guard_proxy_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultBackupSecurityPinRequestsObject( + #[from] resource_guards::get_default_backup_security_pin_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultDeleteProtectedItemRequestsObject( + #[from] resource_guards::get_default_delete_protected_item_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultUpdateProtectionPolicyRequestsObject( + #[from] resource_guards::get_default_update_protection_policy_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultUpdateProtectedItemRequestsObject( + #[from] resource_guards::get_default_update_protected_item_requests_object::Error, + ), +} +pub mod backup_vaults { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_in_subscription(&self, subscription_id: impl Into) -> get_in_subscription::Builder { + get_in_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_in_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get_in_resource_group::Builder { + get_in_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "API to check for resource name availability"] + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + location: impl Into, + parameters: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + parameters: parameters.into(), + } + } + } + pub mod get_in_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/backupVaults", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_in_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Created201(models::BackupVaultResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupVaultResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::PatchResourceRequestInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) parameters: models::CheckNameAvailabilityRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_result { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for a resource."] + pub fn get( + &self, + subscription_id: impl Into, + operation_id: impl Into, + location: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + location: location.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::OperationJobExtendedInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for a resource."] + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_vault_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_protection { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Validates if a feature is supported"] + pub fn check_feature_support( + &self, + subscription_id: impl Into, + location: impl Into, + parameters: impl Into, + ) -> check_feature_support::Builder { + check_feature_support::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + parameters: parameters.into(), + } + } + } + pub mod check_feature_support { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) parameters: models::FeatureValidationRequestBase, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/checkFeatureSupport", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FeatureValidationResponseBase = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_protection_operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.DataProtection/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientDiscoveryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_policies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets a backup policy belonging to a backup vault"] + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_policy_name: backup_policy_name.into(), + } + } + #[doc = "Creates or Updates a backup policy belonging to a backup vault"] + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_policy_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_policy_name: backup_policy_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a backup policy belonging to a backup vault"] + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_policy_name: backup_policy_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_policy_name: String, + pub(crate) parameters: models::BaseBackupPolicyResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_instances { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn adhoc_backup( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> adhoc_backup::Builder { + adhoc_backup::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn validate_for_backup( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> validate_for_backup::Builder { + validate_for_backup::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn trigger_rehydrate( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + vault_name: impl Into, + parameters: impl Into, + backup_instance_name: impl Into, + ) -> trigger_rehydrate::Builder { + trigger_rehydrate::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn trigger_restore( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> trigger_restore::Builder { + trigger_restore::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn validate_for_restore( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> validate_for_restore::Builder { + validate_for_restore::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInstanceResource), + Created201(models::BackupInstanceResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::BackupInstanceResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod adhoc_backup { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::TriggerBackupRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_for_backup { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::ValidateForBackupRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/validateForBackup", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod trigger_rehydrate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::AzureBackupRehydrationRequest, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/rehydrate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod trigger_restore { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::AzureBackupRestoreRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/restore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_for_restore { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::ValidateRestoreRequestObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/validateRestore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + filter: None, + skip_token: None, + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + recovery_point_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + recovery_point_id: recovery_point_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/recoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupRecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + pub(crate) recovery_point_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/recoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupRecoveryPointResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod jobs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + job_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + job_id: job_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupJobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) job_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.job_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupJobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_time_ranges { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn find( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> find::Builder { + find::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + } + pub mod find { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::AzureBackupFindRestorableTimeRangesRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/findRestorableTimeRanges" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupFindRestorableTimeRangesResponseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod export_jobs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod trigger { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/exportBackupJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod export_jobs_operation_result { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExportJobsResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs/operations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExportJobsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_guards { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns ResourceGuards collection belonging to a subscription."] + pub fn get_resources_in_subscription(&self, subscription_id: impl Into) -> get_resources_in_subscription::Builder { + get_resources_in_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Returns ResourceGuards collection belonging to a ResourceGroup."] + pub fn get_resources_in_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get_resources_in_resource_group::Builder { + get_resources_in_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Returns a ResourceGuard belonging to a resource group."] + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Creates or updates a ResourceGuard resource belonging to a resource group."] + pub fn put( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + parameters: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource."] + pub fn patch( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + parameters: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a ResourceGuard resource from the resource group."] + pub fn delete( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_disable_soft_delete_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_disable_soft_delete_requests_objects::Builder { + get_disable_soft_delete_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_delete_resource_guard_proxy_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_delete_resource_guard_proxy_requests_objects::Builder { + get_delete_resource_guard_proxy_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_backup_security_pin_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_backup_security_pin_requests_objects::Builder { + get_backup_security_pin_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_delete_protected_item_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_delete_protected_item_requests_objects::Builder { + get_delete_protected_item_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_update_protection_policy_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_update_protection_policy_requests_objects::Builder { + get_update_protection_policy_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_update_protected_item_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_update_protected_item_requests_objects::Builder { + get_update_protected_item_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_disable_soft_delete_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_disable_soft_delete_requests_object::Builder { + get_default_disable_soft_delete_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_delete_resource_guard_proxy_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_delete_resource_guard_proxy_requests_object::Builder { + get_default_delete_resource_guard_proxy_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_backup_security_pin_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_backup_security_pin_requests_object::Builder { + get_default_backup_security_pin_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_delete_protected_item_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_delete_protected_item_requests_object::Builder { + get_default_delete_protected_item_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_update_protection_policy_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_update_protection_policy_requests_object::Builder { + get_default_update_protection_policy_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_update_protected_item_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_update_protected_item_requests_object::Builder { + get_default_update_protected_item_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + } + pub mod get_resources_in_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/resourceGuards", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_resources_in_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) parameters: models::ResourceGuardResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) parameters: models::PatchResourceRequestInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_disable_soft_delete_requests_objects { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/disableSoftDeleteRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_delete_resource_guard_proxy_requests_objects { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteResourceGuardProxyRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_backup_security_pin_requests_objects { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/getBackupSecurityPINRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_delete_protected_item_requests_objects { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteProtectedItemRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_update_protection_policy_requests_objects { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectionPolicyRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_update_protected_item_requests_objects { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectedItemRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_disable_soft_delete_requests_object { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/disableSoftDeleteRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_delete_resource_guard_proxy_requests_object { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteResourceGuardProxyRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_backup_security_pin_requests_object { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/getBackupSecurityPINRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_delete_protected_item_requests_object { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteProtectedItemRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_update_protection_policy_requests_object { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectionPolicyRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_update_protected_item_requests_object { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectedItemRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/deviceupdate/src/package_2020_03_01_preview/models.rs b/services/mgmt/deviceupdate/src/package_2020_03_01_preview/models.rs index d4170f6c80..1bc9f5bb54 100644 --- a/services/mgmt/deviceupdate/src/package_2020_03_01_preview/models.rs +++ b/services/mgmt/deviceupdate/src/package_2020_03_01_preview/models.rs @@ -21,6 +21,8 @@ pub mod account { pub host_name: Option, #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] pub public_network_access: Option, + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, } pub mod properties { use super::*; @@ -296,8 +298,7 @@ pub struct PrivateEndpoint { pub struct PrivateEndpointConnection { #[serde(flatten)] pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub properties: PrivateEndpointConnectionProperties, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PrivateEndpointConnectionListResult { @@ -310,6 +311,8 @@ pub struct PrivateEndpointConnectionProperties { pub private_endpoint: Option, #[serde(rename = "privateLinkServiceConnectionState")] pub private_link_service_connection_state: PrivateLinkServiceConnectionState, + #[serde(rename = "groupIds", default, skip_serializing_if = "Vec::is_empty")] + pub group_ids: Vec, #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] pub provisioning_state: Option, } diff --git a/services/mgmt/elastic/Cargo.toml b/services/mgmt/elastic/Cargo.toml index 99998b6430..5a1fc41dad 100644 --- a/services/mgmt/elastic/Cargo.toml +++ b/services/mgmt/elastic/Cargo.toml @@ -23,5 +23,7 @@ default = ["package-2020-07-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-09-01-preview" = [] +"package-2021-10-01-preview" = [] "package-2020-07-01-preview" = [] "package-2020-07-01" = [] diff --git a/services/mgmt/elastic/src/lib.rs b/services/mgmt/elastic/src/lib.rs index c2f71c3c51..cdc3102edf 100644 --- a/services/mgmt/elastic/src/lib.rs +++ b/services/mgmt/elastic/src/lib.rs @@ -3,6 +3,14 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-09-01-preview")] +pub mod package_2021_09_01_preview; +#[cfg(all(feature = "package-2021-09-01-preview", not(feature = "no-default-version")))] +pub use package_2021_09_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-10-01-preview")] +pub mod package_2021_10_01_preview; +#[cfg(all(feature = "package-2021-10-01-preview", not(feature = "no-default-version")))] +pub use package_2021_10_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2020-07-01-preview")] pub mod package_2020_07_01_preview; #[cfg(all(feature = "package-2020-07-01-preview", not(feature = "no-default-version")))] diff --git a/services/mgmt/elastic/src/package_2021_09_01_preview/mod.rs b/services/mgmt/elastic/src/package_2021_09_01_preview/mod.rs new file mode 100644 index 0000000000..8eb0528b0a --- /dev/null +++ b/services/mgmt/elastic/src/package_2021_09_01_preview/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-09-01-preview"; diff --git a/services/mgmt/elastic/src/package_2021_09_01_preview/models.rs b/services/mgmt/elastic/src/package_2021_09_01_preview/models.rs new file mode 100644 index 0000000000..02c5a31a26 --- /dev/null +++ b/services/mgmt/elastic/src/package_2021_09_01_preview/models.rs @@ -0,0 +1,364 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CompanyInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub domain: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub business: Option, + #[serde(rename = "employeesNumber", default, skip_serializing_if = "Option::is_none")] + pub employees_number: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub country: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeploymentInfoResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "memoryCapacity", default, skip_serializing_if = "Option::is_none")] + pub memory_capacity: Option, + #[serde(rename = "diskCapacity", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticCloudDeployment { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "deploymentId", default, skip_serializing_if = "Option::is_none")] + pub deployment_id: Option, + #[serde(rename = "azureSubscriptionId", default, skip_serializing_if = "Option::is_none")] + pub azure_subscription_id: Option, + #[serde(rename = "elasticsearchRegion", default, skip_serializing_if = "Option::is_none")] + pub elasticsearch_region: Option, + #[serde(rename = "elasticsearchServiceUrl", default, skip_serializing_if = "Option::is_none")] + pub elasticsearch_service_url: Option, + #[serde(rename = "kibanaServiceUrl", default, skip_serializing_if = "Option::is_none")] + pub kibana_service_url: Option, + #[serde(rename = "kibanaSsoUrl", default, skip_serializing_if = "Option::is_none")] + pub kibana_sso_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticCloudUser { + #[serde(rename = "emailAddress", default, skip_serializing_if = "Option::is_none")] + pub email_address: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "elasticCloudSsoDefaultUrl", default, skip_serializing_if = "Option::is_none")] + pub elastic_cloud_sso_default_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ElasticDeploymentStatus { + Healthy, + Unhealthy, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticMonitorResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticMonitorResourceListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticMonitorResourceUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticProperties { + #[serde(rename = "elasticCloudUser", default, skip_serializing_if = "Option::is_none")] + pub elastic_cloud_user: Option, + #[serde(rename = "elasticCloudDeployment", default, skip_serializing_if = "Option::is_none")] + pub elastic_cloud_deployment: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponseBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExternalUserCreationResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub created: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExternalUserInfo { + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[serde(rename = "fullName", default, skip_serializing_if = "Option::is_none")] + pub full_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "emailId", default, skip_serializing_if = "Option::is_none")] + pub email_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub roles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FilteringTag { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProperties { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum LiftrResourceCategories { + Unknown, + MonitorLogs, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogRules { + #[serde(rename = "sendAadLogs", default, skip_serializing_if = "Option::is_none")] + pub send_aad_logs: Option, + #[serde(rename = "sendSubscriptionLogs", default, skip_serializing_if = "Option::is_none")] + pub send_subscription_logs: Option, + #[serde(rename = "sendActivityLogs", default, skip_serializing_if = "Option::is_none")] + pub send_activity_logs: Option, + #[serde(rename = "filteringTags", default, skip_serializing_if = "Vec::is_empty")] + pub filtering_tags: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ManagedIdentityTypes { + SystemAssigned, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitorProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "monitoringStatus", default, skip_serializing_if = "Option::is_none")] + pub monitoring_status: Option, + #[serde(rename = "elasticProperties", default, skip_serializing_if = "Option::is_none")] + pub elastic_properties: Option, + #[serde(rename = "userInfo", default, skip_serializing_if = "Option::is_none")] + pub user_info: Option, + #[serde(rename = "liftrResourceCategory", default, skip_serializing_if = "Option::is_none")] + pub liftr_resource_category: Option, + #[serde(rename = "liftrResourcePreference", default, skip_serializing_if = "Option::is_none")] + pub liftr_resource_preference: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoredResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "sendingLogs", default, skip_serializing_if = "Option::is_none")] + pub sending_logs: Option, + #[serde(rename = "reasonForLogsStatus", default, skip_serializing_if = "Option::is_none")] + pub reason_for_logs_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoredResourceListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum MonitoringStatus { + Enabled, + Disabled, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringTagRules { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringTagRulesListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringTagRulesProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "logRules", default, skip_serializing_if = "Option::is_none")] + pub log_rules: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OperationName { + Add, + Delete, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + Accepted, + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + Deleted, + NotSpecified, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceProviderDefaultErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSku { + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SendingLogs { + True, + False, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TagAction { + Include, + Exclude, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserInfo { + #[serde(rename = "firstName", default, skip_serializing_if = "Option::is_none")] + pub first_name: Option, + #[serde(rename = "lastName", default, skip_serializing_if = "Option::is_none")] + pub last_name: Option, + #[serde(rename = "companyName", default, skip_serializing_if = "Option::is_none")] + pub company_name: Option, + #[serde(rename = "emailAddress", default, skip_serializing_if = "Option::is_none")] + pub email_address: Option, + #[serde(rename = "companyInfo", default, skip_serializing_if = "Option::is_none")] + pub company_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmCollectionUpdate { + #[serde(rename = "vmResourceId", default, skip_serializing_if = "Option::is_none")] + pub vm_resource_id: Option, + #[serde(rename = "operationName", default, skip_serializing_if = "Option::is_none")] + pub operation_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmHostListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmIngestionDetailsResponse { + #[serde(rename = "cloudId", default, skip_serializing_if = "Option::is_none")] + pub cloud_id: Option, + #[serde(rename = "ingestionKey", default, skip_serializing_if = "Option::is_none")] + pub ingestion_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmResources { + #[serde(rename = "vmResourceId", default, skip_serializing_if = "Option::is_none")] + pub vm_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/elastic/src/package_2021_09_01_preview/operations.rs b/services/mgmt/elastic/src/package_2021_09_01_preview/operations.rs new file mode 100644 index 0000000000..0bbf187f43 --- /dev/null +++ b/services/mgmt/elastic/src/package_2021_09_01_preview/operations.rs @@ -0,0 +1,1805 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn deployment_info(&self) -> deployment_info::Client { + deployment_info::Client(self.clone()) + } + pub fn external_user(&self) -> external_user::Client { + external_user::Client(self.clone()) + } + pub fn monitored_resources(&self) -> monitored_resources::Client { + monitored_resources::Client(self.clone()) + } + pub fn monitors(&self) -> monitors::Client { + monitors::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn tag_rules(&self) -> tag_rules::Client { + tag_rules::Client(self.clone()) + } + pub fn vm_collection(&self) -> vm_collection::Client { + vm_collection::Client(self.clone()) + } + pub fn vm_host(&self) -> vm_host::Client { + vm_host::Client(self.clone()) + } + pub fn vm_ingestion(&self) -> vm_ingestion::Client { + vm_ingestion::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Monitors_List(#[from] monitors::list::Error), + #[error(transparent)] + Monitors_ListByResourceGroup(#[from] monitors::list_by_resource_group::Error), + #[error(transparent)] + Monitors_Get(#[from] monitors::get::Error), + #[error(transparent)] + Monitors_Create(#[from] monitors::create::Error), + #[error(transparent)] + Monitors_Update(#[from] monitors::update::Error), + #[error(transparent)] + Monitors_Delete(#[from] monitors::delete::Error), + #[error(transparent)] + MonitoredResources_List(#[from] monitored_resources::list::Error), + #[error(transparent)] + DeploymentInfo_List(#[from] deployment_info::list::Error), + #[error(transparent)] + ExternalUser_CreateOrUpdate(#[from] external_user::create_or_update::Error), + #[error(transparent)] + TagRules_List(#[from] tag_rules::list::Error), + #[error(transparent)] + TagRules_Get(#[from] tag_rules::get::Error), + #[error(transparent)] + TagRules_CreateOrUpdate(#[from] tag_rules::create_or_update::Error), + #[error(transparent)] + TagRules_Delete(#[from] tag_rules::delete::Error), + #[error(transparent)] + VmHost_List(#[from] vm_host::list::Error), + #[error(transparent)] + VmIngestion_Details(#[from] vm_ingestion::details::Error), + #[error(transparent)] + VmCollection_Update(#[from] vm_collection::update::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List all operations provided by Microsoft.Elastic."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Elastic/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod monitors { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List all monitors under the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "List all monitors under the specified resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Get the properties of a specific monitor resource."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + #[doc = "Create a monitor resource."] + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + #[doc = "Update a monitor resource."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + #[doc = "Delete a monitor resource."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Elastic/monitors", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResourceListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResourceListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ElasticMonitorResource), + Created201(models::ElasticMonitorResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod monitored_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List the resources currently being monitored by the Elastic monitor resource."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/listMonitoredResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoredResourceListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod deployment_info { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/listDeploymentInfo", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentInfoResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod external_user { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment"] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/createOrUpdateExternalUser", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExternalUserCreationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tag_rules { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List the tag rules for a given monitor resource."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + #[doc = "Get a tag rule set for a given monitor resource."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + rule_set_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + rule_set_name: rule_set_name.into(), + } + } + #[doc = "Create or update a tag rule set for a given monitor resource."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + rule_set_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + rule_set_name: rule_set_name.into(), + body: None, + } + } + #[doc = "Delete a tag rule set for a given monitor resource."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + rule_set_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + rule_set_name: rule_set_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/tagRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringTagRulesListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) rule_set_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/tagRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringTagRules = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) rule_set_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/tagRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringTagRules = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) rule_set_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/tagRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vm_host { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List the vm resources currently being monitored by the Elastic monitor resource."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/listVMHost", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmHostListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vm_ingestion { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List the vm ingestion details that will be monitored by the Elastic monitor resource."] + pub fn details( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> details::Builder { + details::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod details { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/vmIngestionDetails", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmIngestionDetailsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vm_collection { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Update the vm details that will be monitored by the Elastic monitor resource."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/vmCollectionUpdate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/elastic/src/package_2021_10_01_preview/mod.rs b/services/mgmt/elastic/src/package_2021_10_01_preview/mod.rs new file mode 100644 index 0000000000..16e962c0fd --- /dev/null +++ b/services/mgmt/elastic/src/package_2021_10_01_preview/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-10-01-preview"; diff --git a/services/mgmt/elastic/src/package_2021_10_01_preview/models.rs b/services/mgmt/elastic/src/package_2021_10_01_preview/models.rs new file mode 100644 index 0000000000..74922e9703 --- /dev/null +++ b/services/mgmt/elastic/src/package_2021_10_01_preview/models.rs @@ -0,0 +1,378 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CompanyInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub domain: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub business: Option, + #[serde(rename = "employeesNumber", default, skip_serializing_if = "Option::is_none")] + pub employees_number: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub country: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeploymentInfoResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "memoryCapacity", default, skip_serializing_if = "Option::is_none")] + pub memory_capacity: Option, + #[serde(rename = "diskCapacity", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticCloudDeployment { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "deploymentId", default, skip_serializing_if = "Option::is_none")] + pub deployment_id: Option, + #[serde(rename = "azureSubscriptionId", default, skip_serializing_if = "Option::is_none")] + pub azure_subscription_id: Option, + #[serde(rename = "elasticsearchRegion", default, skip_serializing_if = "Option::is_none")] + pub elasticsearch_region: Option, + #[serde(rename = "elasticsearchServiceUrl", default, skip_serializing_if = "Option::is_none")] + pub elasticsearch_service_url: Option, + #[serde(rename = "kibanaServiceUrl", default, skip_serializing_if = "Option::is_none")] + pub kibana_service_url: Option, + #[serde(rename = "kibanaSsoUrl", default, skip_serializing_if = "Option::is_none")] + pub kibana_sso_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticCloudUser { + #[serde(rename = "emailAddress", default, skip_serializing_if = "Option::is_none")] + pub email_address: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "elasticCloudSsoDefaultUrl", default, skip_serializing_if = "Option::is_none")] + pub elastic_cloud_sso_default_url: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ElasticDeploymentStatus { + Healthy, + Unhealthy, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticMonitorResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticMonitorResourceListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticMonitorResourceUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticMonitorUpgrade { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticProperties { + #[serde(rename = "elasticCloudUser", default, skip_serializing_if = "Option::is_none")] + pub elastic_cloud_user: Option, + #[serde(rename = "elasticCloudDeployment", default, skip_serializing_if = "Option::is_none")] + pub elastic_cloud_deployment: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponseBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExternalUserCreationResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub created: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExternalUserInfo { + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[serde(rename = "fullName", default, skip_serializing_if = "Option::is_none")] + pub full_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "emailId", default, skip_serializing_if = "Option::is_none")] + pub email_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub roles: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FilteringTag { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProperties { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum LiftrResourceCategories { + Unknown, + MonitorLogs, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogRules { + #[serde(rename = "sendAadLogs", default, skip_serializing_if = "Option::is_none")] + pub send_aad_logs: Option, + #[serde(rename = "sendSubscriptionLogs", default, skip_serializing_if = "Option::is_none")] + pub send_subscription_logs: Option, + #[serde(rename = "sendActivityLogs", default, skip_serializing_if = "Option::is_none")] + pub send_activity_logs: Option, + #[serde(rename = "filteringTags", default, skip_serializing_if = "Vec::is_empty")] + pub filtering_tags: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ManagedIdentityTypes { + SystemAssigned, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitorProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "monitoringStatus", default, skip_serializing_if = "Option::is_none")] + pub monitoring_status: Option, + #[serde(rename = "elasticProperties", default, skip_serializing_if = "Option::is_none")] + pub elastic_properties: Option, + #[serde(rename = "userInfo", default, skip_serializing_if = "Option::is_none")] + pub user_info: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "liftrResourceCategory", default, skip_serializing_if = "Option::is_none")] + pub liftr_resource_category: Option, + #[serde(rename = "liftrResourcePreference", default, skip_serializing_if = "Option::is_none")] + pub liftr_resource_preference: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoredResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "sendingLogs", default, skip_serializing_if = "Option::is_none")] + pub sending_logs: Option, + #[serde(rename = "reasonForLogsStatus", default, skip_serializing_if = "Option::is_none")] + pub reason_for_logs_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoredResourceListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum MonitoringStatus { + Enabled, + Disabled, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringTagRules { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringTagRulesListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringTagRulesProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "logRules", default, skip_serializing_if = "Option::is_none")] + pub log_rules: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OperationName { + Add, + Delete, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + Accepted, + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, + Deleted, + NotSpecified, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceProviderDefaultErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSku { + pub name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SendingLogs { + True, + False, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TagAction { + Include, + Exclude, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradableVersionsList { + #[serde(rename = "currentVersion", default, skip_serializing_if = "Option::is_none")] + pub current_version: Option, + #[serde(rename = "upgradableVersions", default, skip_serializing_if = "Vec::is_empty")] + pub upgradable_versions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserInfo { + #[serde(rename = "firstName", default, skip_serializing_if = "Option::is_none")] + pub first_name: Option, + #[serde(rename = "lastName", default, skip_serializing_if = "Option::is_none")] + pub last_name: Option, + #[serde(rename = "companyName", default, skip_serializing_if = "Option::is_none")] + pub company_name: Option, + #[serde(rename = "emailAddress", default, skip_serializing_if = "Option::is_none")] + pub email_address: Option, + #[serde(rename = "companyInfo", default, skip_serializing_if = "Option::is_none")] + pub company_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmCollectionUpdate { + #[serde(rename = "vmResourceId", default, skip_serializing_if = "Option::is_none")] + pub vm_resource_id: Option, + #[serde(rename = "operationName", default, skip_serializing_if = "Option::is_none")] + pub operation_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmHostListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmIngestionDetailsResponse { + #[serde(rename = "cloudId", default, skip_serializing_if = "Option::is_none")] + pub cloud_id: Option, + #[serde(rename = "ingestionKey", default, skip_serializing_if = "Option::is_none")] + pub ingestion_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmResources { + #[serde(rename = "vmResourceId", default, skip_serializing_if = "Option::is_none")] + pub vm_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/elastic/src/package_2021_10_01_preview/operations.rs b/services/mgmt/elastic/src/package_2021_10_01_preview/operations.rs new file mode 100644 index 0000000000..71b1a77d76 --- /dev/null +++ b/services/mgmt/elastic/src/package_2021_10_01_preview/operations.rs @@ -0,0 +1,2016 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn deployment_info(&self) -> deployment_info::Client { + deployment_info::Client(self.clone()) + } + pub fn external_user(&self) -> external_user::Client { + external_user::Client(self.clone()) + } + pub fn monitor(&self) -> monitor::Client { + monitor::Client(self.clone()) + } + pub fn monitored_resources(&self) -> monitored_resources::Client { + monitored_resources::Client(self.clone()) + } + pub fn monitors(&self) -> monitors::Client { + monitors::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn tag_rules(&self) -> tag_rules::Client { + tag_rules::Client(self.clone()) + } + pub fn upgradable_versions(&self) -> upgradable_versions::Client { + upgradable_versions::Client(self.clone()) + } + pub fn vm_collection(&self) -> vm_collection::Client { + vm_collection::Client(self.clone()) + } + pub fn vm_host(&self) -> vm_host::Client { + vm_host::Client(self.clone()) + } + pub fn vm_ingestion(&self) -> vm_ingestion::Client { + vm_ingestion::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Monitors_List(#[from] monitors::list::Error), + #[error(transparent)] + Monitors_ListByResourceGroup(#[from] monitors::list_by_resource_group::Error), + #[error(transparent)] + Monitors_Get(#[from] monitors::get::Error), + #[error(transparent)] + Monitors_Create(#[from] monitors::create::Error), + #[error(transparent)] + Monitors_Update(#[from] monitors::update::Error), + #[error(transparent)] + Monitors_Delete(#[from] monitors::delete::Error), + #[error(transparent)] + MonitoredResources_List(#[from] monitored_resources::list::Error), + #[error(transparent)] + DeploymentInfo_List(#[from] deployment_info::list::Error), + #[error(transparent)] + ExternalUser_CreateOrUpdate(#[from] external_user::create_or_update::Error), + #[error(transparent)] + TagRules_List(#[from] tag_rules::list::Error), + #[error(transparent)] + TagRules_Get(#[from] tag_rules::get::Error), + #[error(transparent)] + TagRules_CreateOrUpdate(#[from] tag_rules::create_or_update::Error), + #[error(transparent)] + TagRules_Delete(#[from] tag_rules::delete::Error), + #[error(transparent)] + VmHost_List(#[from] vm_host::list::Error), + #[error(transparent)] + VmIngestion_Details(#[from] vm_ingestion::details::Error), + #[error(transparent)] + VmCollection_Update(#[from] vm_collection::update::Error), + #[error(transparent)] + UpgradableVersions_Details(#[from] upgradable_versions::details::Error), + #[error(transparent)] + Monitor_Upgrade(#[from] monitor::upgrade::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List all operations provided by Microsoft.Elastic."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Elastic/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod monitors { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List all monitors under the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "List all monitors under the specified resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Get the properties of a specific monitor resource."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + #[doc = "Create a monitor resource."] + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + #[doc = "Update a monitor resource."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + #[doc = "Delete a monitor resource."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Elastic/monitors", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResourceListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResourceListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ElasticMonitorResource), + Created201(models::ElasticMonitorResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticMonitorResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod monitored_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List the resources currently being monitored by the Elastic monitor resource."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/listMonitoredResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoredResourceListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod deployment_info { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/listDeploymentInfo", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentInfoResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod external_user { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment"] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/createOrUpdateExternalUser", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExternalUserCreationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tag_rules { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List the tag rules for a given monitor resource."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + #[doc = "Get a tag rule set for a given monitor resource."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + rule_set_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + rule_set_name: rule_set_name.into(), + } + } + #[doc = "Create or update a tag rule set for a given monitor resource."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + rule_set_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + rule_set_name: rule_set_name.into(), + body: None, + } + } + #[doc = "Delete a tag rule set for a given monitor resource."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + rule_set_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + rule_set_name: rule_set_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/tagRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringTagRulesListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) rule_set_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/tagRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringTagRules = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) rule_set_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/tagRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringTagRules = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) rule_set_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/tagRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name, + &self.rule_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vm_host { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List the vm resources currently being monitored by the Elastic monitor resource."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/listVMHost", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmHostListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vm_ingestion { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List the vm ingestion details that will be monitored by the Elastic monitor resource."] + pub fn details( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> details::Builder { + details::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod details { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/vmIngestionDetails", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmIngestionDetailsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vm_collection { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Update the vm details that will be monitored by the Elastic monitor resource."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/vmCollectionUpdate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod upgradable_versions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List of upgradable versions for a given monitor resource."] + pub fn details( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> details::Builder { + details::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + } + } + } + pub mod details { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/listUpgradableVersions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpgradableVersionsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod monitor { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Upgradable version for a monitor resource."] + pub fn upgrade( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + monitor_name: impl Into, + ) -> upgrade::Builder { + upgrade::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + monitor_name: monitor_name.into(), + body: None, + } + } + } + pub mod upgrade { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ResourceProviderDefaultErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) monitor_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Elastic/monitors/{}/upgrade", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderDefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/eventgrid/src/package_2021_12/models.rs b/services/mgmt/eventgrid/src/package_2021_12/models.rs index 17217e72d4..6e58699e3a 100644 --- a/services/mgmt/eventgrid/src/package_2021_12/models.rs +++ b/services/mgmt/eventgrid/src/package_2021_12/models.rs @@ -25,6 +25,13 @@ pub mod advanced_filter { StringBeginsWith, StringEndsWith, StringContains, + NumberInRange, + NumberNotInRange, + StringNotBeginsWith, + StringNotEndsWith, + StringNotContains, + IsNullOrUndefined, + IsNotNull, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -532,6 +539,16 @@ pub mod input_schema_mapping { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IsNotNullAdvancedFilter { + #[serde(flatten)] + pub advanced_filter: AdvancedFilter, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IsNullOrUndefinedAdvancedFilter { + #[serde(flatten)] + pub advanced_filter: AdvancedFilter, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct JsonField { #[serde(rename = "sourceField", default, skip_serializing_if = "Option::is_none")] pub source_field: Option, @@ -587,6 +604,13 @@ pub struct NumberInAdvancedFilter { pub values: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NumberInRangeAdvancedFilter { + #[serde(flatten)] + pub advanced_filter: AdvancedFilter, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec>, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct NumberLessThanAdvancedFilter { #[serde(flatten)] pub advanced_filter: AdvancedFilter, @@ -608,6 +632,13 @@ pub struct NumberNotInAdvancedFilter { pub values: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NumberNotInRangeAdvancedFilter { + #[serde(flatten)] + pub advanced_filter: AdvancedFilter, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec>, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Operation { #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, @@ -822,6 +853,27 @@ pub struct StringInAdvancedFilter { pub values: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StringNotBeginsWithAdvancedFilter { + #[serde(flatten)] + pub advanced_filter: AdvancedFilter, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StringNotContainsAdvancedFilter { + #[serde(flatten)] + pub advanced_filter: AdvancedFilter, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StringNotEndsWithAdvancedFilter { + #[serde(flatten)] + pub advanced_filter: AdvancedFilter, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct StringNotInAdvancedFilter { #[serde(flatten)] pub advanced_filter: AdvancedFilter, diff --git a/services/mgmt/imagebuilder/Cargo.toml b/services/mgmt/imagebuilder/Cargo.toml index f8d606b906..5645ffe244 100644 --- a/services/mgmt/imagebuilder/Cargo.toml +++ b/services/mgmt/imagebuilder/Cargo.toml @@ -19,10 +19,11 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2020-02", "enable_reqwest"] +default = ["package-2021-10", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-10" = [] "package-2020-02" = [] "package-preview-2019-05" = [] "package-2018-02" = [] diff --git a/services/mgmt/imagebuilder/src/lib.rs b/services/mgmt/imagebuilder/src/lib.rs index 25ce93ccd6..a3d62c46df 100644 --- a/services/mgmt/imagebuilder/src/lib.rs +++ b/services/mgmt/imagebuilder/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-10")] +pub mod package_2021_10; +#[cfg(all(feature = "package-2021-10", not(feature = "no-default-version")))] +pub use package_2021_10::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2020-02")] pub mod package_2020_02; #[cfg(all(feature = "package-2020-02", not(feature = "no-default-version")))] diff --git a/services/mgmt/imagebuilder/src/package_2021_10/mod.rs b/services/mgmt/imagebuilder/src/package_2021_10/mod.rs new file mode 100644 index 0000000000..cdd7552b47 --- /dev/null +++ b/services/mgmt/imagebuilder/src/package_2021_10/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-10-01"; diff --git a/services/mgmt/imagebuilder/src/package_2021_10/models.rs b/services/mgmt/imagebuilder/src/package_2021_10/models.rs new file mode 100644 index 0000000000..3633c63167 --- /dev/null +++ b/services/mgmt/imagebuilder/src/package_2021_10/models.rs @@ -0,0 +1,431 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplate { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + pub identity: ImageTemplateIdentity, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateCustomizer { + #[serde(rename = "type")] + pub type_: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateDistributor { + #[serde(rename = "type")] + pub type_: String, + #[serde(rename = "runOutputName")] + pub run_output_name: String, + #[serde(rename = "artifactTags", default, skip_serializing_if = "Option::is_none")] + pub artifact_tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateFileCustomizer { + #[serde(flatten)] + pub image_template_customizer: ImageTemplateCustomizer, + #[serde(rename = "sourceUri", default, skip_serializing_if = "Option::is_none")] + pub source_uri: Option, + #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")] + pub sha256_checksum: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub destination: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateIdentity { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod image_template_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + UserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateLastRunStatus { + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "runState", default, skip_serializing_if = "Option::is_none")] + pub run_state: Option, + #[serde(rename = "runSubState", default, skip_serializing_if = "Option::is_none")] + pub run_sub_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +pub mod image_template_last_run_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RunState { + Running, + Canceling, + Succeeded, + PartiallySucceeded, + Failed, + Canceled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RunSubState { + Queued, + Building, + Customizing, + Distributing, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateManagedImageDistributor { + #[serde(flatten)] + pub image_template_distributor: ImageTemplateDistributor, + #[serde(rename = "imageId")] + pub image_id: String, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateManagedImageSource { + #[serde(flatten)] + pub image_template_source: ImageTemplateSource, + #[serde(rename = "imageId")] + pub image_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplatePlatformImageSource { + #[serde(flatten)] + pub image_template_source: ImageTemplateSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub offer: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "exactVersion", default, skip_serializing_if = "Option::is_none")] + pub exact_version: Option, + #[serde(rename = "planInfo", default, skip_serializing_if = "Option::is_none")] + pub plan_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplatePowerShellCustomizer { + #[serde(flatten)] + pub image_template_customizer: ImageTemplateCustomizer, + #[serde(rename = "scriptUri", default, skip_serializing_if = "Option::is_none")] + pub script_uri: Option, + #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")] + pub sha256_checksum: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub inline: Vec, + #[serde(rename = "runElevated", default, skip_serializing_if = "Option::is_none")] + pub run_elevated: Option, + #[serde(rename = "runAsSystem", default, skip_serializing_if = "Option::is_none")] + pub run_as_system: Option, + #[serde(rename = "validExitCodes", default, skip_serializing_if = "Vec::is_empty")] + pub valid_exit_codes: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateProperties { + pub source: ImageTemplateSource, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub customize: Vec, + pub distribute: Vec, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisioningError", default, skip_serializing_if = "Option::is_none")] + pub provisioning_error: Option, + #[serde(rename = "lastRunStatus", default, skip_serializing_if = "Option::is_none")] + pub last_run_status: Option, + #[serde(rename = "buildTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub build_timeout_in_minutes: Option, + #[serde(rename = "vmProfile", default, skip_serializing_if = "Option::is_none")] + pub vm_profile: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateRestartCustomizer { + #[serde(flatten)] + pub image_template_customizer: ImageTemplateCustomizer, + #[serde(rename = "restartCommand", default, skip_serializing_if = "Option::is_none")] + pub restart_command: Option, + #[serde(rename = "restartCheckCommand", default, skip_serializing_if = "Option::is_none")] + pub restart_check_command: Option, + #[serde(rename = "restartTimeout", default, skip_serializing_if = "Option::is_none")] + pub restart_timeout: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateSharedImageDistributor { + #[serde(flatten)] + pub image_template_distributor: ImageTemplateDistributor, + #[serde(rename = "galleryImageId")] + pub gallery_image_id: String, + #[serde(rename = "replicationRegions")] + pub replication_regions: Vec, + #[serde(rename = "excludeFromLatest", default, skip_serializing_if = "Option::is_none")] + pub exclude_from_latest: Option, + #[serde(rename = "storageAccountType", default, skip_serializing_if = "Option::is_none")] + pub storage_account_type: Option, +} +pub mod image_template_shared_image_distributor { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageAccountType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Standard_ZRS")] + StandardZrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateSharedImageVersionSource { + #[serde(flatten)] + pub image_template_source: ImageTemplateSource, + #[serde(rename = "imageVersionId")] + pub image_version_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateShellCustomizer { + #[serde(flatten)] + pub image_template_customizer: ImageTemplateCustomizer, + #[serde(rename = "scriptUri", default, skip_serializing_if = "Option::is_none")] + pub script_uri: Option, + #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")] + pub sha256_checksum: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub inline: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateSource { + #[serde(rename = "type")] + pub type_: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateVhdDistributor { + #[serde(flatten)] + pub image_template_distributor: ImageTemplateDistributor, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateVmProfile { + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identities: Vec, + #[serde(rename = "vnetConfig", default, skip_serializing_if = "Option::is_none")] + pub vnet_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageTemplateWindowsUpdateCustomizer { + #[serde(flatten)] + pub image_template_customizer: ImageTemplateCustomizer, + #[serde(rename = "searchCriteria", default, skip_serializing_if = "Option::is_none")] + pub search_criteria: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub filters: Vec, + #[serde(rename = "updateLimit", default, skip_serializing_if = "Option::is_none")] + pub update_limit: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PlatformImagePurchasePlan { + #[serde(rename = "planName")] + pub plan_name: String, + #[serde(rename = "planProduct")] + pub plan_product: String, + #[serde(rename = "planPublisher")] + pub plan_publisher: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProvisioningError { + #[serde(rename = "provisioningErrorCode", default, skip_serializing_if = "Option::is_none")] + pub provisioning_error_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +pub mod provisioning_error { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningErrorCode { + BadSourceType, + #[serde(rename = "BadPIRSource")] + BadPirSource, + BadManagedImageSource, + BadSharedImageVersionSource, + BadCustomizerType, + UnsupportedCustomizerType, + NoCustomizerScript, + BadDistributeType, + BadSharedImageDistribute, + ServerError, + Other, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + Creating, + Updating, + Succeeded, + Failed, + Deleting, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunOutput { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunOutputCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunOutputProperties { + #[serde(rename = "artifactId", default, skip_serializing_if = "Option::is_none")] + pub artifact_id: Option, + #[serde(rename = "artifactUri", default, skip_serializing_if = "Option::is_none")] + pub artifact_uri: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + pub name: String, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkConfig { + #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] + pub subnet_id: Option, + #[serde(rename = "proxyVmSize", default, skip_serializing_if = "Option::is_none")] + pub proxy_vm_size: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/imagebuilder/src/package_2021_10/operations.rs b/services/mgmt/imagebuilder/src/package_2021_10/operations.rs new file mode 100644 index 0000000000..52c1541d83 --- /dev/null +++ b/services/mgmt/imagebuilder/src/package_2021_10/operations.rs @@ -0,0 +1,1118 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn virtual_machine_image_templates(&self) -> virtual_machine_image_templates::Client { + virtual_machine_image_templates::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + VirtualMachineImageTemplates_List(#[from] virtual_machine_image_templates::list::Error), + #[error(transparent)] + VirtualMachineImageTemplates_ListByResourceGroup(#[from] virtual_machine_image_templates::list_by_resource_group::Error), + #[error(transparent)] + VirtualMachineImageTemplates_Get(#[from] virtual_machine_image_templates::get::Error), + #[error(transparent)] + VirtualMachineImageTemplates_CreateOrUpdate(#[from] virtual_machine_image_templates::create_or_update::Error), + #[error(transparent)] + VirtualMachineImageTemplates_Update(#[from] virtual_machine_image_templates::update::Error), + #[error(transparent)] + VirtualMachineImageTemplates_Delete(#[from] virtual_machine_image_templates::delete::Error), + #[error(transparent)] + VirtualMachineImageTemplates_Run(#[from] virtual_machine_image_templates::run::Error), + #[error(transparent)] + VirtualMachineImageTemplates_Cancel(#[from] virtual_machine_image_templates::cancel::Error), + #[error(transparent)] + VirtualMachineImageTemplates_ListRunOutputs(#[from] virtual_machine_image_templates::list_run_outputs::Error), + #[error(transparent)] + VirtualMachineImageTemplates_GetRunOutput(#[from] virtual_machine_image_templates::get_run_output::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), +} +pub mod virtual_machine_image_templates { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + image_template_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + image_template_name: image_template_name.into(), + } + } + pub fn create_or_update( + &self, + parameters: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + image_template_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + image_template_name: image_template_name.into(), + } + } + pub fn update( + &self, + parameters: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + image_template_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + image_template_name: image_template_name.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + image_template_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + image_template_name: image_template_name.into(), + } + } + pub fn run( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + image_template_name: impl Into, + ) -> run::Builder { + run::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + image_template_name: image_template_name.into(), + } + } + pub fn cancel( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + image_template_name: impl Into, + ) -> cancel::Builder { + cancel::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + image_template_name: image_template_name.into(), + } + } + pub fn list_run_outputs( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + image_template_name: impl Into, + ) -> list_run_outputs::Builder { + list_run_outputs::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + image_template_name: image_template_name.into(), + } + } + pub fn get_run_output( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + image_template_name: impl Into, + run_output_name: impl Into, + ) -> get_run_output::Builder { + get_run_output::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + image_template_name: image_template_name.into(), + run_output_name: run_output_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.VirtualMachineImages/imageTemplates", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImageTemplateListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImageTemplateListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) image_template_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImageTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ImageTemplate), + Created201(models::ImageTemplate), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::ImageTemplate, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) image_template_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImageTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImageTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ImageTemplate), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::ImageTemplateUpdateParameters, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) image_template_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImageTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) image_template_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) image_template_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates/{}/run", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod cancel { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) image_template_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates/{}/cancel", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_run_outputs { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) image_template_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates/{}/runOutputs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunOutputCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_run_output { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) image_template_name: String, + pub(crate) run_output_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.VirtualMachineImages/imageTemplates/{}/runOutputs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.image_template_name, + &self.run_output_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.VirtualMachineImages/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/kubernetesconfiguration/Cargo.toml b/services/mgmt/kubernetesconfiguration/Cargo.toml index 4125551022..748239585b 100644 --- a/services/mgmt/kubernetesconfiguration/Cargo.toml +++ b/services/mgmt/kubernetesconfiguration/Cargo.toml @@ -23,4 +23,5 @@ default = ["package-2021-09", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-preview-2022-01" = [] "package-2021-09" = [] diff --git a/services/mgmt/kubernetesconfiguration/src/lib.rs b/services/mgmt/kubernetesconfiguration/src/lib.rs index db29bb17b8..a2f931d082 100644 --- a/services/mgmt/kubernetesconfiguration/src/lib.rs +++ b/services/mgmt/kubernetesconfiguration/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-preview-2022-01")] +pub mod package_preview_2022_01; +#[cfg(all(feature = "package-preview-2022-01", not(feature = "no-default-version")))] +pub use package_preview_2022_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-09")] pub mod package_2021_09; #[cfg(all(feature = "package-2021-09", not(feature = "no-default-version")))] diff --git a/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/mod.rs b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/mod.rs new file mode 100644 index 0000000000..fc476b12c2 --- /dev/null +++ b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2022-01-01-preview"; diff --git a/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/models.rs b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/models.rs new file mode 100644 index 0000000000..fbf8d19f64 --- /dev/null +++ b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/models.rs @@ -0,0 +1,731 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BucketDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "bucketName", default, skip_serializing_if = "Option::is_none")] + pub bucket_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub insecure: Option, + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] + pub access_key: Option, + #[serde(rename = "localAuthRef", default, skip_serializing_if = "Option::is_none")] + pub local_auth_ref: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BucketPatchDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "bucketName", default, skip_serializing_if = "Option::is_none")] + pub bucket_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub insecure: Option, + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] + pub access_key: Option, + #[serde(rename = "localAuthRef", default, skip_serializing_if = "Option::is_none")] + pub local_auth_ref: Option, +} +pub type ChartValues = String; +pub type ChartVersion = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClusterScopeSettings { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod cluster_scope_settings { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Properties { + #[serde(rename = "allowMultipleInstances", default, skip_serializing_if = "Option::is_none")] + pub allow_multiple_instances: Option, + #[serde(rename = "defaultReleaseNamespace", default, skip_serializing_if = "Option::is_none")] + pub default_release_namespace: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ComplianceStatus { + #[serde(rename = "complianceState", default, skip_serializing_if = "Option::is_none")] + pub compliance_state: Option, + #[serde(rename = "lastConfigApplied", default, skip_serializing_if = "Option::is_none")] + pub last_config_applied: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "messageLevel", default, skip_serializing_if = "Option::is_none")] + pub message_level: Option, +} +pub mod compliance_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComplianceState { + Pending, + Compliant, + Noncompliant, + Installed, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MessageLevel { + Error, + Warning, + Information, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationProtectedSettings {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DependsOnDefinition { + #[serde(rename = "kustomizationName", default, skip_serializing_if = "Option::is_none")] + pub kustomization_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Extension { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +pub mod extension { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Properties { + #[serde(rename = "extensionType", default, skip_serializing_if = "Option::is_none")] + pub extension_type: Option, + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[serde(rename = "releaseTrain", default, skip_serializing_if = "Option::is_none")] + pub release_train: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[serde(rename = "configurationSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_settings: Option, + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, + #[serde(rename = "errorInfo", default, skip_serializing_if = "Option::is_none")] + pub error_info: Option, + #[serde(rename = "customLocationSettings", default, skip_serializing_if = "Option::is_none")] + pub custom_location_settings: Option, + #[serde(rename = "packageUri", default, skip_serializing_if = "Option::is_none")] + pub package_uri: Option, + #[serde(rename = "aksAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub aks_assigned_identity: Option, + } + pub mod properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct AksAssignedIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + } + pub mod aks_assigned_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + } + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(rename = "displayStatus", default, skip_serializing_if = "Option::is_none")] + pub display_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub level: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, +} +pub mod extension_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Level { + Error, + Warning, + Information, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionType { + pub properties: ExtensionTypeProperties, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionTypeList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionTypeProperties { + #[serde(rename = "releaseTrains", default, skip_serializing_if = "Vec::is_empty")] + pub release_trains: Vec, + #[serde(rename = "clusterTypes", default, skip_serializing_if = "Option::is_none")] + pub cluster_types: Option, + #[serde(rename = "supportedScopes", default, skip_serializing_if = "Option::is_none")] + pub supported_scopes: Option, +} +pub mod extension_type_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ClusterTypes { + #[serde(rename = "connectedClusters")] + ConnectedClusters, + #[serde(rename = "managedClusters")] + ManagedClusters, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionVersionList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub versions: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionsList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FluxComplianceStateDefinition { + Compliant, + #[serde(rename = "Non-Compliant")] + NonCompliant, + Pending, + Suspended, + Unknown, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FluxConfiguration { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +pub mod flux_configuration { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Properties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, + #[serde(rename = "sourceKind", default, skip_serializing_if = "Option::is_none")] + pub source_kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub suspend: Option, + #[serde(rename = "gitRepository", default, skip_serializing_if = "Option::is_none")] + pub git_repository: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bucket: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kustomizations: Option, + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, + #[serde(rename = "repositoryPublicKey", default, skip_serializing_if = "Option::is_none")] + pub repository_public_key: Option, + #[serde(rename = "lastSourceUpdatedCommitId", default, skip_serializing_if = "Option::is_none")] + pub last_source_updated_commit_id: Option, + #[serde(rename = "lastSourceUpdatedAt", default, skip_serializing_if = "Option::is_none")] + pub last_source_updated_at: Option, + #[serde(rename = "complianceState", default, skip_serializing_if = "Option::is_none")] + pub compliance_state: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FluxConfigurationPatch { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod flux_configuration_patch { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Properties { + #[serde(rename = "sourceKind", default, skip_serializing_if = "Option::is_none")] + pub source_kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub suspend: Option, + #[serde(rename = "gitRepository", default, skip_serializing_if = "Option::is_none")] + pub git_repository: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bucket: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kustomizations: Option, + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FluxConfigurationsList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GitRepositoryDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[serde(rename = "repositoryRef", default, skip_serializing_if = "Option::is_none")] + pub repository_ref: Option, + #[serde(rename = "sshKnownHosts", default, skip_serializing_if = "Option::is_none")] + pub ssh_known_hosts: Option, + #[serde(rename = "httpsUser", default, skip_serializing_if = "Option::is_none")] + pub https_user: Option, + #[serde(rename = "httpsCACert", default, skip_serializing_if = "Option::is_none")] + pub https_ca_cert: Option, + #[serde(rename = "localAuthRef", default, skip_serializing_if = "Option::is_none")] + pub local_auth_ref: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GitRepositoryPatchDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[serde(rename = "repositoryRef", default, skip_serializing_if = "Option::is_none")] + pub repository_ref: Option, + #[serde(rename = "sshKnownHosts", default, skip_serializing_if = "Option::is_none")] + pub ssh_known_hosts: Option, + #[serde(rename = "httpsUser", default, skip_serializing_if = "Option::is_none")] + pub https_user: Option, + #[serde(rename = "httpsCACert", default, skip_serializing_if = "Option::is_none")] + pub https_ca_cert: Option, + #[serde(rename = "localAuthRef", default, skip_serializing_if = "Option::is_none")] + pub local_auth_ref: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HelmOperatorProperties { + #[serde(rename = "chartVersion", default, skip_serializing_if = "Option::is_none")] + pub chart_version: Option, + #[serde(rename = "chartValues", default, skip_serializing_if = "Option::is_none")] + pub chart_values: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HelmReleasePropertiesDefinition { + #[serde(rename = "lastRevisionApplied", default, skip_serializing_if = "Option::is_none")] + pub last_revision_applied: Option, + #[serde(rename = "helmChartRef", default, skip_serializing_if = "Option::is_none")] + pub helm_chart_ref: Option, + #[serde(rename = "failureCount", default, skip_serializing_if = "Option::is_none")] + pub failure_count: Option, + #[serde(rename = "installFailureCount", default, skip_serializing_if = "Option::is_none")] + pub install_failure_count: Option, + #[serde(rename = "upgradeFailureCount", default, skip_serializing_if = "Option::is_none")] + pub upgrade_failure_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Identity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KustomizationDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "dependsOn", default, skip_serializing_if = "Vec::is_empty")] + pub depends_on: Vec, + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[serde(rename = "retryIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub retry_interval_in_seconds: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prune: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub force: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KustomizationPatchDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "dependsOn", default, skip_serializing_if = "Vec::is_empty")] + pub depends_on: Vec, + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[serde(rename = "retryIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub retry_interval_in_seconds: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prune: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub force: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KustomizationValidationDefinition { + #[serde(rename = "none")] + None, + #[serde(rename = "client")] + Client, + #[serde(rename = "server")] + Server, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjectReferenceDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjectStatusConditionDefinition { + #[serde(rename = "lastTransitionTime", default, skip_serializing_if = "Option::is_none")] + pub last_transition_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjectStatusDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(rename = "complianceState", default, skip_serializing_if = "Option::is_none")] + pub compliance_state: Option, + #[serde(rename = "appliedBy", default, skip_serializing_if = "Option::is_none")] + pub applied_by: Option, + #[serde(rename = "statusConditions", default, skip_serializing_if = "Vec::is_empty")] + pub status_conditions: Vec, + #[serde(rename = "helmReleaseProperties", default, skip_serializing_if = "Option::is_none")] + pub helm_release_properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusResult { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + pub status: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OperatorScopeDefinition { + #[serde(rename = "cluster")] + Cluster, + #[serde(rename = "namespace")] + Namespace, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OperatorTypeDefinition { + Flux, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningStateDefinition { + Succeeded, + Failed, + Canceled, + Creating, + Updating, + Deleting, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RepositoryRefDefinition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub semver: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceProviderOperation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, +} +pub mod resource_provider_operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceProviderOperationList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Scope { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cluster: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScopeCluster { + #[serde(rename = "releaseNamespace", default, skip_serializing_if = "Option::is_none")] + pub release_namespace: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScopeDefinition { + #[serde(rename = "cluster")] + Cluster, + #[serde(rename = "namespace")] + Namespace, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScopeNamespace { + #[serde(rename = "targetNamespace", default, skip_serializing_if = "Option::is_none")] + pub target_namespace: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceControlConfiguration { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +pub mod source_control_configuration { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Properties { + #[serde(rename = "repositoryUrl", default, skip_serializing_if = "Option::is_none")] + pub repository_url: Option, + #[serde(rename = "operatorNamespace", default, skip_serializing_if = "Option::is_none")] + pub operator_namespace: Option, + #[serde(rename = "operatorInstanceName", default, skip_serializing_if = "Option::is_none")] + pub operator_instance_name: Option, + #[serde(rename = "operatorType", default, skip_serializing_if = "Option::is_none")] + pub operator_type: Option, + #[serde(rename = "operatorParams", default, skip_serializing_if = "Option::is_none")] + pub operator_params: Option, + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + #[serde(rename = "operatorScope", default, skip_serializing_if = "Option::is_none")] + pub operator_scope: Option, + #[serde(rename = "repositoryPublicKey", default, skip_serializing_if = "Option::is_none")] + pub repository_public_key: Option, + #[serde(rename = "sshKnownHostsContents", default, skip_serializing_if = "Option::is_none")] + pub ssh_known_hosts_contents: Option, + #[serde(rename = "enableHelmOperator", default, skip_serializing_if = "Option::is_none")] + pub enable_helm_operator: Option, + #[serde(rename = "helmOperatorProperties", default, skip_serializing_if = "Option::is_none")] + pub helm_operator_properties: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "complianceStatus", default, skip_serializing_if = "Option::is_none")] + pub compliance_status: Option, + } + pub mod properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Accepted, + Deleting, + Running, + Succeeded, + Failed, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceControlConfigurationList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SourceKindDefinition { + GitRepository, + Bucket, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedScopes { + #[serde(rename = "defaultScope", default, skip_serializing_if = "Option::is_none")] + pub default_scope: Option, + #[serde(rename = "clusterScopeSettings", default, skip_serializing_if = "Option::is_none")] + pub cluster_scope_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PatchExtension { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod patch_extension { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Properties { + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[serde(rename = "releaseTrain", default, skip_serializing_if = "Option::is_none")] + pub release_train: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "configurationSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_settings: Option, + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/operations.rs b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/operations.rs new file mode 100644 index 0000000000..1a0a9edde3 --- /dev/null +++ b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01/operations.rs @@ -0,0 +1,2317 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn cluster_extension_type(&self) -> cluster_extension_type::Client { + cluster_extension_type::Client(self.clone()) + } + pub fn cluster_extension_types(&self) -> cluster_extension_types::Client { + cluster_extension_types::Client(self.clone()) + } + pub fn extension_type_versions(&self) -> extension_type_versions::Client { + extension_type_versions::Client(self.clone()) + } + pub fn extensions(&self) -> extensions::Client { + extensions::Client(self.clone()) + } + pub fn flux_config_operation_status(&self) -> flux_config_operation_status::Client { + flux_config_operation_status::Client(self.clone()) + } + pub fn flux_configurations(&self) -> flux_configurations::Client { + flux_configurations::Client(self.clone()) + } + pub fn location_extension_types(&self) -> location_extension_types::Client { + location_extension_types::Client(self.clone()) + } + pub fn operation_status(&self) -> operation_status::Client { + operation_status::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn source_control_configurations(&self) -> source_control_configurations::Client { + source_control_configurations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + ClusterExtensionType_Get(#[from] cluster_extension_type::get::Error), + #[error(transparent)] + ClusterExtensionTypes_List(#[from] cluster_extension_types::list::Error), + #[error(transparent)] + ExtensionTypeVersions_List(#[from] extension_type_versions::list::Error), + #[error(transparent)] + LocationExtensionTypes_List(#[from] location_extension_types::list::Error), + #[error(transparent)] + Extensions_Get(#[from] extensions::get::Error), + #[error(transparent)] + Extensions_Create(#[from] extensions::create::Error), + #[error(transparent)] + Extensions_Update(#[from] extensions::update::Error), + #[error(transparent)] + Extensions_Delete(#[from] extensions::delete::Error), + #[error(transparent)] + Extensions_List(#[from] extensions::list::Error), + #[error(transparent)] + OperationStatus_Get(#[from] operation_status::get::Error), + #[error(transparent)] + FluxConfigurations_Get(#[from] flux_configurations::get::Error), + #[error(transparent)] + FluxConfigurations_CreateOrUpdate(#[from] flux_configurations::create_or_update::Error), + #[error(transparent)] + FluxConfigurations_Update(#[from] flux_configurations::update::Error), + #[error(transparent)] + FluxConfigurations_Delete(#[from] flux_configurations::delete::Error), + #[error(transparent)] + FluxConfigurations_List(#[from] flux_configurations::list::Error), + #[error(transparent)] + FluxConfigOperationStatus_Get(#[from] flux_config_operation_status::get::Error), + #[error(transparent)] + SourceControlConfigurations_Get(#[from] source_control_configurations::get::Error), + #[error(transparent)] + SourceControlConfigurations_CreateOrUpdate(#[from] source_control_configurations::create_or_update::Error), + #[error(transparent)] + SourceControlConfigurations_Delete(#[from] source_control_configurations::delete::Error), + #[error(transparent)] + SourceControlConfigurations_List(#[from] source_control_configurations::list::Error), + #[error(transparent)] + OperationStatus_List(#[from] operation_status::list::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), +} +pub mod cluster_extension_type { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_type_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_type_name: extension_type_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_type_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_type_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionType = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cluster_extension_types { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensionTypes" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionTypeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod extension_type_versions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + extension_type_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + extension_type_name: extension_type_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) extension_type_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.KubernetesConfiguration/locations/{}/extensionTypes/{}/versions", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.extension_type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionVersionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod location_extension_types { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into, location: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.KubernetesConfiguration/locations/{}/extensionTypes", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionTypeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod extensions { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + extension: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + extension: extension.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + patch_extension: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + patch_extension: patch_extension.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + force_delete: None, + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Extension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Created201(models::Extension), + Ok200(models::Extension), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + pub(crate) extension: models::Extension, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Extension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Extension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + pub(crate) patch_extension: models::PatchExtension, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.patch_extension).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Extension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + pub(crate) force_delete: Option, + } + impl Builder { + pub fn force_delete(mut self, force_delete: bool) -> Self { + self.force_delete = Some(force_delete); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(force_delete) = &self.force_delete { + url.query_pairs_mut().append_pair("forceDelete", &force_delete.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_rp, + &self.cluster_resource_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + operation_id: operation_id.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/operations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_rp, + &self.cluster_resource_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatusList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod flux_configurations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + flux_configuration: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + flux_configuration: flux_configuration.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + flux_configuration_patch: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + flux_configuration_patch: flux_configuration_patch.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + force_delete: None, + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::FluxConfiguration), + Created201(models::FluxConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + pub(crate) flux_configuration: models::FluxConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.flux_configuration).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + pub(crate) flux_configuration_patch: models::FluxConfigurationPatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.flux_configuration_patch).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + pub(crate) force_delete: Option, + } + impl Builder { + pub fn force_delete(mut self, force_delete: bool) -> Self { + self.force_delete = Some(force_delete); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(force_delete) = &self.force_delete { + url.query_pairs_mut().append_pair("forceDelete", &force_delete.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfigurationsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod flux_config_operation_status { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod source_control_configurations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + source_control_configuration_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + source_control_configuration_name: source_control_configuration_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + source_control_configuration_name: impl Into, + source_control_configuration: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + source_control_configuration_name: source_control_configuration_name.into(), + source_control_configuration: source_control_configuration.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + source_control_configuration_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + source_control_configuration_name: source_control_configuration_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) source_control_configuration_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . source_control_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceControlConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::SourceControlConfiguration), + Created201(models::SourceControlConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) source_control_configuration_name: String, + pub(crate) source_control_configuration: models::SourceControlConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . source_control_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.source_control_configuration).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceControlConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceControlConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) source_control_configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . source_control_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceControlConfigurationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.KubernetesConfiguration/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderOperationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/loadtestservice/Cargo.toml b/services/mgmt/loadtestservice/Cargo.toml new file mode 100644 index 0000000000..a887e79c63 --- /dev/null +++ b/services/mgmt/loadtestservice/Cargo.toml @@ -0,0 +1,26 @@ +# generated by AutoRust 0.1.0 +[package] +name = "azure_mgmt_loadtestservice" +version = "0.1.0" +edition = "2018" + +[dependencies] +azure_core = { path = "../../../sdk/core", version = "0.1.0", default-features = false } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +bytes = "1.0" +thiserror = "1.0" +http = "0.2" +url = "2.2" +futures = "0.3" + +[dev-dependencies] +azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } +tokio = { version = "1.0", features = ["macros"] } + +[features] +default = ["package-2021-12-01-preview", "enable_reqwest"] +enable_reqwest = ["azure_core/enable_reqwest"] +enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] +no-default-version = [] +"package-2021-12-01-preview" = [] diff --git a/services/mgmt/loadtestservice/src/lib.rs b/services/mgmt/loadtestservice/src/lib.rs new file mode 100644 index 0000000000..c1946c49d2 --- /dev/null +++ b/services/mgmt/loadtestservice/src/lib.rs @@ -0,0 +1,9 @@ +#![allow(clippy::module_inception)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::ptr_arg)] +#![allow(clippy::large_enum_variant)] +#![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-12-01-preview")] +pub mod package_2021_12_01_preview; +#[cfg(all(feature = "package-2021-12-01-preview", not(feature = "no-default-version")))] +pub use package_2021_12_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/loadtestservice/src/package_2021_12_01_preview/mod.rs b/services/mgmt/loadtestservice/src/package_2021_12_01_preview/mod.rs new file mode 100644 index 0000000000..40526a463d --- /dev/null +++ b/services/mgmt/loadtestservice/src/package_2021_12_01_preview/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-12-01-preview"; diff --git a/services/mgmt/loadtestservice/src/package_2021_12_01_preview/models.rs b/services/mgmt/loadtestservice/src/package_2021_12_01_preview/models.rs new file mode 100644 index 0000000000..d9cdb557dc --- /dev/null +++ b/services/mgmt/loadtestservice/src/package_2021_12_01_preview/models.rs @@ -0,0 +1,190 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadTestProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "dataPlaneURI", default, skip_serializing_if = "Option::is_none")] + pub data_plane_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadTestResource { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadTestResourcePageList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadTestResourcePatchRequestBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod load_test_resource_patch_request_body { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Properties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + #[serde(rename = "user")] + User, + #[serde(rename = "system")] + System, + #[serde(rename = "user,system")] + UserSystem, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ResourceState { + Succeeded, + Failed, + Canceled, + Deleted, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemAssignedServiceIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type")] + pub type_: SystemAssignedServiceIdentityType, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SystemAssignedServiceIdentityType { + None, + SystemAssigned, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/loadtestservice/src/package_2021_12_01_preview/operations.rs b/services/mgmt/loadtestservice/src/package_2021_12_01_preview/operations.rs new file mode 100644 index 0000000000..f4a746ecac --- /dev/null +++ b/services/mgmt/loadtestservice/src/package_2021_12_01_preview/operations.rs @@ -0,0 +1,721 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn load_tests(&self) -> load_tests::Client { + load_tests::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + LoadTests_ListBySubscription(#[from] load_tests::list_by_subscription::Error), + #[error(transparent)] + LoadTests_ListByResourceGroup(#[from] load_tests::list_by_resource_group::Error), + #[error(transparent)] + LoadTests_Get(#[from] load_tests::get::Error), + #[error(transparent)] + LoadTests_CreateOrUpdate(#[from] load_tests::create_or_update::Error), + #[error(transparent)] + LoadTests_Update(#[from] load_tests::update::Error), + #[error(transparent)] + LoadTests_Delete(#[from] load_tests::delete::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.LoadTestService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_tests { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + load_test_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + load_test_name: load_test_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + load_test_name: impl Into, + load_test_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + load_test_name: load_test_name.into(), + load_test_resource: load_test_resource.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + load_test_name: impl Into, + load_test_resource_patch_request_body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + load_test_name: load_test_name.into(), + load_test_resource_patch_request_body: load_test_resource_patch_request_body.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + load_test_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + load_test_name: load_test_name.into(), + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.LoadTestService/loadTests", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResourcePageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResourcePageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) load_test_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_test_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) load_test_name: String, + pub(crate) load_test_resource: models::LoadTestResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_test_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.load_test_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) load_test_name: String, + pub(crate) load_test_resource_patch_request_body: models::LoadTestResourcePatchRequestBody, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_test_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.load_test_resource_patch_request_body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) load_test_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_test_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/monitor/src/package_2021_09/models.rs b/services/mgmt/monitor/src/package_2021_09/models.rs index 2d7934f501..590059883c 100644 --- a/services/mgmt/monitor/src/package_2021_09/models.rs +++ b/services/mgmt/monitor/src/package_2021_09/models.rs @@ -77,62 +77,16 @@ pub struct ActionGroupResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActivityLogAlert { - pub scopes: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - pub condition: ActivityLogAlertAllOfCondition, - pub actions: ActivityLogAlertActionList, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActivityLogAlertActionGroup { - #[serde(rename = "actionGroupId")] - pub action_group_id: String, - #[serde(rename = "webhookProperties", default, skip_serializing_if = "Option::is_none")] - pub webhook_properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActivityLogAlertActionList { +pub struct ActionList { #[serde(rename = "actionGroups", default, skip_serializing_if = "Vec::is_empty")] - pub action_groups: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActivityLogAlertAllOfCondition { - #[serde(rename = "allOf")] - pub all_of: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActivityLogAlertLeafCondition { - pub field: String, - pub equals: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActivityLogAlertList { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActivityLogAlertPatch { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActivityLogAlertPatchBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub action_groups: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ActivityLogAlertResource { #[serde(flatten)] - pub resource: Resource, + pub azure_resource: AzureResource, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum AggregationType { @@ -161,6 +115,56 @@ pub struct AlertRule { pub last_updated_time: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleAllOfCondition { + #[serde(rename = "allOf")] + pub all_of: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleAnyOfOrLeafCondition { + #[serde(flatten)] + pub alert_rule_leaf_condition: AlertRuleLeafCondition, + #[serde(rename = "anyOf", default, skip_serializing_if = "Vec::is_empty")] + pub any_of: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleLeafCondition { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub field: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub equals: Option, + #[serde(rename = "containsAny", default, skip_serializing_if = "Vec::is_empty")] + pub contains_any: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRulePatchObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRulePatchProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleProperties { + pub scopes: Vec, + pub condition: AlertRuleAllOfCondition, + pub actions: ActionList, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AlertRuleResource { #[serde(flatten)] pub resource: Resource, diff --git a/services/mgmt/monitor/src/package_2021_09/operations.rs b/services/mgmt/monitor/src/package_2021_09/operations.rs index fd3dd67aee..b5b34f8248 100644 --- a/services/mgmt/monitor/src/package_2021_09/operations.rs +++ b/services/mgmt/monitor/src/package_2021_09/operations.rs @@ -7218,14 +7218,14 @@ pub mod activity_log_alerts { subscription_id: impl Into, resource_group_name: impl Into, activity_log_alert_name: impl Into, - activity_log_alert: impl Into, + activity_log_alert_rule: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), activity_log_alert_name: activity_log_alert_name.into(), - activity_log_alert: activity_log_alert.into(), + activity_log_alert_rule: activity_log_alert_rule.into(), } } pub fn update( @@ -7233,14 +7233,14 @@ pub mod activity_log_alerts { subscription_id: impl Into, resource_group_name: impl Into, activity_log_alert_name: impl Into, - activity_log_alert_patch: impl Into, + activity_log_alert_rule_patch: impl Into, ) -> update::Builder { update::Builder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), activity_log_alert_name: activity_log_alert_name.into(), - activity_log_alert_patch: activity_log_alert_patch.into(), + activity_log_alert_rule_patch: activity_log_alert_rule_patch.into(), } } pub fn delete( @@ -7309,7 +7309,7 @@ pub mod activity_log_alerts { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/activityLogAlerts/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/activityLogAlerts/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7386,13 +7386,13 @@ pub mod activity_log_alerts { pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) activity_log_alert_name: String, - pub(crate) activity_log_alert: models::ActivityLogAlertResource, + pub(crate) activity_log_alert_rule: models::ActivityLogAlertResource, } impl Builder { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/activityLogAlerts/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/activityLogAlerts/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7409,7 +7409,7 @@ pub mod activity_log_alerts { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", super::API_VERSION); req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.activity_log_alert).map_err(Error::Serialize)?; + let req_body = azure_core::to_json(&self.activity_log_alert_rule).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -7471,13 +7471,13 @@ pub mod activity_log_alerts { pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) activity_log_alert_name: String, - pub(crate) activity_log_alert_patch: models::ActivityLogAlertPatchBody, + pub(crate) activity_log_alert_rule_patch: models::AlertRulePatchObject, } impl Builder { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/activityLogAlerts/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/activityLogAlerts/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7494,7 +7494,7 @@ pub mod activity_log_alerts { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", super::API_VERSION); req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.activity_log_alert_patch).map_err(Error::Serialize)?; + let req_body = azure_core::to_json(&self.activity_log_alert_rule_patch).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -7560,7 +7560,7 @@ pub mod activity_log_alerts { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/activityLogAlerts/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/activityLogAlerts/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7628,10 +7628,10 @@ pub mod activity_log_alerts { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/providers/microsoft.insights/activityLogAlerts", + "{}/subscriptions/{}/providers/Microsoft.Insights/activityLogAlerts", self.client.endpoint(), &self.subscription_id ); @@ -7653,7 +7653,7 @@ pub mod activity_log_alerts { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ActivityLogAlertList = + let rsp_value: models::AlertRuleList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7702,10 +7702,10 @@ pub mod activity_log_alerts { pub(crate) resource_group_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/activityLogAlerts", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/activityLogAlerts", self.client.endpoint(), &self.subscription_id, &self.resource_group_name @@ -7728,7 +7728,7 @@ pub mod activity_log_alerts { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ActivityLogAlertList = + let rsp_value: models::AlertRuleList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/netapp/Cargo.toml b/services/mgmt/netapp/Cargo.toml index 60b1238d78..5f4464520d 100644 --- a/services/mgmt/netapp/Cargo.toml +++ b/services/mgmt/netapp/Cargo.toml @@ -19,10 +19,11 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-netapp-2021-06-01", "enable_reqwest"] +default = ["package-netapp-2021-08-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-netapp-2021-08-01" = [] "package-netapp-2021-06-01" = [] "package-netapp-2021-04-01" = [] "package-netapp-2021-04-01-preview" = [] diff --git a/services/mgmt/netapp/src/lib.rs b/services/mgmt/netapp/src/lib.rs index c98d66298c..e528622fa6 100644 --- a/services/mgmt/netapp/src/lib.rs +++ b/services/mgmt/netapp/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-netapp-2021-08-01")] +pub mod package_netapp_2021_08_01; +#[cfg(all(feature = "package-netapp-2021-08-01", not(feature = "no-default-version")))] +pub use package_netapp_2021_08_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-netapp-2021-06-01")] pub mod package_netapp_2021_06_01; #[cfg(all(feature = "package-netapp-2021-06-01", not(feature = "no-default-version")))] diff --git a/services/mgmt/netapp/src/package_netapp_2021_08_01/mod.rs b/services/mgmt/netapp/src/package_netapp_2021_08_01/mod.rs new file mode 100644 index 0000000000..fdc89d4415 --- /dev/null +++ b/services/mgmt/netapp/src/package_netapp_2021_08_01/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-08-01"; diff --git a/services/mgmt/netapp/src/package_netapp_2021_08_01/models.rs b/services/mgmt/netapp/src/package_netapp_2021_08_01/models.rs new file mode 100644 index 0000000000..2e499d3f88 --- /dev/null +++ b/services/mgmt/netapp/src/package_netapp_2021_08_01/models.rs @@ -0,0 +1,1257 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckAvailabilityResponse { + #[serde(rename = "isAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +pub mod check_availability_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Reason { + Invalid, + AlreadyExists, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Dimension { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FilePathAvailabilityRequest { + pub name: String, + #[serde(rename = "subnetId")] + pub subnet_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "supportedAggregationTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_aggregation_types: Vec, + #[serde(rename = "supportedTimeGrainTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_time_grain_types: Vec, + #[serde(rename = "internalMetricName", default, skip_serializing_if = "Option::is_none")] + pub internal_metric_name: Option, + #[serde(rename = "enableRegionalMdmAccount", default, skip_serializing_if = "Option::is_none")] + pub enable_regional_mdm_account: Option, + #[serde(rename = "sourceMdmAccount", default, skip_serializing_if = "Option::is_none")] + pub source_mdm_account: Option, + #[serde(rename = "sourceMdmNamespace", default, skip_serializing_if = "Option::is_none")] + pub source_mdm_namespace: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dimensions: Vec, + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[serde(rename = "fillGapWithZero", default, skip_serializing_if = "Option::is_none")] + pub fill_gap_with_zero: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(rename = "resourceIdDimensionNameOverride", default, skip_serializing_if = "Option::is_none")] + pub resource_id_dimension_name_override: Option, + #[serde(rename = "isInternal", default, skip_serializing_if = "Option::is_none")] + pub is_internal: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationProperties { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuotaAvailabilityRequest { + pub name: String, + #[serde(rename = "type")] + pub type_: quota_availability_request::Type, + #[serde(rename = "resourceGroup")] + pub resource_group: String, +} +pub mod quota_availability_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "Microsoft.NetApp/netAppAccounts")] + MicrosoftNetAppNetAppAccounts, + #[serde(rename = "Microsoft.NetApp/netAppAccounts/capacityPools")] + MicrosoftNetAppNetAppAccountsCapacityPools, + #[serde(rename = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes")] + MicrosoftNetAppNetAppAccountsCapacityPoolsVolumes, + #[serde(rename = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots")] + MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceNameAvailabilityRequest { + pub name: String, + #[serde(rename = "type")] + pub type_: resource_name_availability_request::Type, + #[serde(rename = "resourceGroup")] + pub resource_group: String, +} +pub mod resource_name_availability_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "Microsoft.NetApp/netAppAccounts")] + MicrosoftNetAppNetAppAccounts, + #[serde(rename = "Microsoft.NetApp/netAppAccounts/capacityPools")] + MicrosoftNetAppNetAppAccountsCapacityPools, + #[serde(rename = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes")] + MicrosoftNetAppNetAppAccountsCapacityPoolsVolumes, + #[serde(rename = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots")] + MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceSpecification { + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubscriptionQuotaItem { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubscriptionQuotaItemList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubscriptionQuotaItemProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub current: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountEncryption { + #[serde(rename = "keySource", default, skip_serializing_if = "Option::is_none")] + pub key_source: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "activeDirectories", default, skip_serializing_if = "Vec::is_empty")] + pub active_directories: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActiveDirectory { + #[serde(rename = "activeDirectoryId", default, skip_serializing_if = "Option::is_none")] + pub active_directory_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub domain: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dns: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "statusDetails", default, skip_serializing_if = "Option::is_none")] + pub status_details: Option, + #[serde(rename = "smbServerName", default, skip_serializing_if = "Option::is_none")] + pub smb_server_name: Option, + #[serde(rename = "organizationalUnit", default, skip_serializing_if = "Option::is_none")] + pub organizational_unit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub site: Option, + #[serde(rename = "backupOperators", default, skip_serializing_if = "Vec::is_empty")] + pub backup_operators: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub administrators: Vec, + #[serde(rename = "kdcIP", default, skip_serializing_if = "Option::is_none")] + pub kdc_ip: Option, + #[serde(rename = "adName", default, skip_serializing_if = "Option::is_none")] + pub ad_name: Option, + #[serde(rename = "serverRootCACertificate", default, skip_serializing_if = "Option::is_none")] + pub server_root_ca_certificate: Option, + #[serde(rename = "aesEncryption", default, skip_serializing_if = "Option::is_none")] + pub aes_encryption: Option, + #[serde(rename = "ldapSigning", default, skip_serializing_if = "Option::is_none")] + pub ldap_signing: Option, + #[serde(rename = "securityOperators", default, skip_serializing_if = "Vec::is_empty")] + pub security_operators: Vec, + #[serde(rename = "ldapOverTLS", default, skip_serializing_if = "Option::is_none")] + pub ldap_over_tls: Option, + #[serde(rename = "allowLocalNfsUsersWithLdap", default, skip_serializing_if = "Option::is_none")] + pub allow_local_nfs_users_with_ldap: Option, + #[serde(rename = "encryptDCConnections", default, skip_serializing_if = "Option::is_none")] + pub encrypt_dc_connections: Option, +} +pub mod active_directory { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Created, + Updating, + InUse, + Deleted, + Error, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthorizeRequest { + #[serde(rename = "remoteVolumeResourceId", default, skip_serializing_if = "Option::is_none")] + pub remote_volume_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Backup { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: BackupProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPatch { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPoliciesList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicy { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub properties: BackupPolicyProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicyDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicyPatch { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicyProperties { + #[serde(rename = "backupPolicyId", default, skip_serializing_if = "Option::is_none")] + pub backup_policy_id: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "dailyBackupsToKeep", default, skip_serializing_if = "Option::is_none")] + pub daily_backups_to_keep: Option, + #[serde(rename = "weeklyBackupsToKeep", default, skip_serializing_if = "Option::is_none")] + pub weekly_backups_to_keep: Option, + #[serde(rename = "monthlyBackupsToKeep", default, skip_serializing_if = "Option::is_none")] + pub monthly_backups_to_keep: Option, + #[serde(rename = "volumesAssigned", default, skip_serializing_if = "Option::is_none")] + pub volumes_assigned: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "volumeBackups", default, skip_serializing_if = "Vec::is_empty")] + pub volume_backups: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupProperties { + #[serde(rename = "backupId", default, skip_serializing_if = "Option::is_none")] + pub backup_id: Option, + #[serde(rename = "creationDate", default, skip_serializing_if = "Option::is_none")] + pub creation_date: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[serde(rename = "backupType", default, skip_serializing_if = "Option::is_none")] + pub backup_type: Option, + #[serde(rename = "failureReason", default, skip_serializing_if = "Option::is_none")] + pub failure_reason: Option, + #[serde(rename = "volumeName", default, skip_serializing_if = "Option::is_none")] + pub volume_name: Option, + #[serde(rename = "useExistingSnapshot", default, skip_serializing_if = "Option::is_none")] + pub use_existing_snapshot: Option, +} +pub mod backup_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupType { + Manual, + Scheduled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub healthy: Option, + #[serde(rename = "relationshipStatus", default, skip_serializing_if = "Option::is_none")] + pub relationship_status: Option, + #[serde(rename = "mirrorState", default, skip_serializing_if = "Option::is_none")] + pub mirror_state: Option, + #[serde(rename = "unhealthyReason", default, skip_serializing_if = "Option::is_none")] + pub unhealthy_reason: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "lastTransferSize", default, skip_serializing_if = "Option::is_none")] + pub last_transfer_size: Option, + #[serde(rename = "lastTransferType", default, skip_serializing_if = "Option::is_none")] + pub last_transfer_type: Option, + #[serde(rename = "totalTransferBytes", default, skip_serializing_if = "Option::is_none")] + pub total_transfer_bytes: Option, +} +pub mod backup_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RelationshipStatus { + Idle, + Transferring, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MirrorState { + Uninitialized, + Mirrored, + Broken, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupsList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BreakReplicationRequest { + #[serde(rename = "forceBreakReplication", default, skip_serializing_if = "Option::is_none")] + pub force_break_replication: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityPool { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub properties: PoolProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityPoolList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapacityPoolPatch { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DailySchedule { + #[serde(rename = "snapshotsToKeep", default, skip_serializing_if = "Option::is_none")] + pub snapshots_to_keep: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hour: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minute: Option, + #[serde(rename = "usedBytes", default, skip_serializing_if = "Option::is_none")] + pub used_bytes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportPolicyRule { + #[serde(rename = "ruleIndex", default, skip_serializing_if = "Option::is_none")] + pub rule_index: Option, + #[serde(rename = "unixReadOnly", default, skip_serializing_if = "Option::is_none")] + pub unix_read_only: Option, + #[serde(rename = "unixReadWrite", default, skip_serializing_if = "Option::is_none")] + pub unix_read_write: Option, + #[serde(rename = "kerberos5ReadOnly", default, skip_serializing_if = "Option::is_none")] + pub kerberos5_read_only: Option, + #[serde(rename = "kerberos5ReadWrite", default, skip_serializing_if = "Option::is_none")] + pub kerberos5_read_write: Option, + #[serde(rename = "kerberos5iReadOnly", default, skip_serializing_if = "Option::is_none")] + pub kerberos5i_read_only: Option, + #[serde(rename = "kerberos5iReadWrite", default, skip_serializing_if = "Option::is_none")] + pub kerberos5i_read_write: Option, + #[serde(rename = "kerberos5pReadOnly", default, skip_serializing_if = "Option::is_none")] + pub kerberos5p_read_only: Option, + #[serde(rename = "kerberos5pReadWrite", default, skip_serializing_if = "Option::is_none")] + pub kerberos5p_read_write: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cifs: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub nfsv3: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub nfsv41: Option, + #[serde(rename = "allowedClients", default, skip_serializing_if = "Option::is_none")] + pub allowed_clients: Option, + #[serde(rename = "hasRootAccess", default, skip_serializing_if = "Option::is_none")] + pub has_root_access: Option, + #[serde(rename = "chownMode", default, skip_serializing_if = "Option::is_none")] + pub chown_mode: Option, +} +pub mod export_policy_rule { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ChownMode { + Restricted, + Unrestricted, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HourlySchedule { + #[serde(rename = "snapshotsToKeep", default, skip_serializing_if = "Option::is_none")] + pub snapshots_to_keep: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minute: Option, + #[serde(rename = "usedBytes", default, skip_serializing_if = "Option::is_none")] + pub used_bytes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonthlySchedule { + #[serde(rename = "snapshotsToKeep", default, skip_serializing_if = "Option::is_none")] + pub snapshots_to_keep: Option, + #[serde(rename = "daysOfMonth", default, skip_serializing_if = "Option::is_none")] + pub days_of_month: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hour: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minute: Option, + #[serde(rename = "usedBytes", default, skip_serializing_if = "Option::is_none")] + pub used_bytes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MountTarget { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub properties: MountTargetProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MountTargetProperties { + #[serde(rename = "mountTargetId", default, skip_serializing_if = "Option::is_none")] + pub mount_target_id: Option, + #[serde(rename = "fileSystemId")] + pub file_system_id: String, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "smbServerFqdn", default, skip_serializing_if = "Option::is_none")] + pub smb_server_fqdn: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetAppAccount { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetAppAccountList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetAppAccountPatch { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PlacementKeyValuePairs { + pub key: String, + pub value: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PoolChangeRequest { + #[serde(rename = "newPoolResourceId")] + pub new_pool_resource_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PoolPatchProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[serde(rename = "qosType", default, skip_serializing_if = "Option::is_none")] + pub qos_type: Option, +} +pub mod pool_patch_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum QosType { + Auto, + Manual, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PoolProperties { + #[serde(rename = "poolId", default, skip_serializing_if = "Option::is_none")] + pub pool_id: Option, + pub size: i64, + #[serde(rename = "serviceLevel")] + pub service_level: ServiceLevel, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "totalThroughputMibps", default, skip_serializing_if = "Option::is_none")] + pub total_throughput_mibps: Option, + #[serde(rename = "utilizedThroughputMibps", default, skip_serializing_if = "Option::is_none")] + pub utilized_throughput_mibps: Option, + #[serde(rename = "qosType", default, skip_serializing_if = "Option::is_none")] + pub qos_type: Option, + #[serde(rename = "coolAccess", default, skip_serializing_if = "Option::is_none")] + pub cool_access: Option, + #[serde(rename = "encryptionType", default, skip_serializing_if = "Option::is_none")] + pub encryption_type: Option, +} +pub mod pool_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum QosType { + Auto, + Manual, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EncryptionType { + Single, + Double, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationObject { + #[serde(rename = "replicationId", default, skip_serializing_if = "Option::is_none")] + pub replication_id: Option, + #[serde(rename = "endpointType", default, skip_serializing_if = "Option::is_none")] + pub endpoint_type: Option, + #[serde(rename = "replicationSchedule", default, skip_serializing_if = "Option::is_none")] + pub replication_schedule: Option, + #[serde(rename = "remoteVolumeResourceId")] + pub remote_volume_resource_id: String, + #[serde(rename = "remoteVolumeRegion", default, skip_serializing_if = "Option::is_none")] + pub remote_volume_region: Option, +} +pub mod replication_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EndpointType { + #[serde(rename = "src")] + Src, + #[serde(rename = "dst")] + Dst, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ReplicationSchedule { + #[serde(rename = "_10minutely")] + N10minutely, + #[serde(rename = "hourly")] + Hourly, + #[serde(rename = "daily")] + Daily, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub healthy: Option, + #[serde(rename = "relationshipStatus", default, skip_serializing_if = "Option::is_none")] + pub relationship_status: Option, + #[serde(rename = "mirrorState", default, skip_serializing_if = "Option::is_none")] + pub mirror_state: Option, + #[serde(rename = "totalProgress", default, skip_serializing_if = "Option::is_none")] + pub total_progress: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, +} +pub mod replication_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RelationshipStatus { + Idle, + Transferring, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MirrorState { + Uninitialized, + Mirrored, + Broken, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceTags {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub healthy: Option, + #[serde(rename = "relationshipStatus", default, skip_serializing_if = "Option::is_none")] + pub relationship_status: Option, + #[serde(rename = "mirrorState", default, skip_serializing_if = "Option::is_none")] + pub mirror_state: Option, + #[serde(rename = "unhealthyReason", default, skip_serializing_if = "Option::is_none")] + pub unhealthy_reason: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "totalTransferBytes", default, skip_serializing_if = "Option::is_none")] + pub total_transfer_bytes: Option, +} +pub mod restore_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RelationshipStatus { + Idle, + Transferring, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MirrorState { + Uninitialized, + Mirrored, + Broken, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ServiceLevel { + Standard, + Premium, + Ultra, + #[serde(rename = "StandardZRS")] + StandardZrs, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Snapshot { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotPatch {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotPoliciesList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotPolicy { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub properties: SnapshotPolicyProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotPolicyDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotPolicyPatch { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotPolicyProperties { + #[serde(rename = "hourlySchedule", default, skip_serializing_if = "Option::is_none")] + pub hourly_schedule: Option, + #[serde(rename = "dailySchedule", default, skip_serializing_if = "Option::is_none")] + pub daily_schedule: Option, + #[serde(rename = "weeklySchedule", default, skip_serializing_if = "Option::is_none")] + pub weekly_schedule: Option, + #[serde(rename = "monthlySchedule", default, skip_serializing_if = "Option::is_none")] + pub monthly_schedule: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotPolicyVolumeList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotProperties { + #[serde(rename = "snapshotId", default, skip_serializing_if = "Option::is_none")] + pub snapshot_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnapshotsList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Vault { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: VaultProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultProperties { + #[serde(rename = "vaultName", default, skip_serializing_if = "Option::is_none")] + pub vault_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Volume { + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub properties: VolumeProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeBackupProperties { + #[serde(rename = "backupPolicyId", default, skip_serializing_if = "Option::is_none")] + pub backup_policy_id: Option, + #[serde(rename = "policyEnforced", default, skip_serializing_if = "Option::is_none")] + pub policy_enforced: Option, + #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] + pub vault_id: Option, + #[serde(rename = "backupEnabled", default, skip_serializing_if = "Option::is_none")] + pub backup_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeBackups { + #[serde(rename = "volumeName", default, skip_serializing_if = "Option::is_none")] + pub volume_name: Option, + #[serde(rename = "backupsCount", default, skip_serializing_if = "Option::is_none")] + pub backups_count: Option, + #[serde(rename = "policyEnabled", default, skip_serializing_if = "Option::is_none")] + pub policy_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroup { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupListProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "groupMetaData", default, skip_serializing_if = "Option::is_none")] + pub group_meta_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupMetaData { + #[serde(rename = "groupDescription", default, skip_serializing_if = "Option::is_none")] + pub group_description: Option, + #[serde(rename = "applicationType", default, skip_serializing_if = "Option::is_none")] + pub application_type: Option, + #[serde(rename = "applicationIdentifier", default, skip_serializing_if = "Option::is_none")] + pub application_identifier: Option, + #[serde(rename = "globalPlacementRules", default, skip_serializing_if = "Vec::is_empty")] + pub global_placement_rules: Vec, + #[serde(rename = "deploymentSpecId", default, skip_serializing_if = "Option::is_none")] + pub deployment_spec_id: Option, + #[serde(rename = "volumesCount", default, skip_serializing_if = "Option::is_none")] + pub volumes_count: Option, +} +pub mod volume_group_meta_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ApplicationType { + #[serde(rename = "SAP-HANA")] + SapHana, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "groupMetaData", default, skip_serializing_if = "Option::is_none")] + pub group_meta_data: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub volumes: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupVolumeProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub properties: VolumeProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumePatch { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumePatchProperties { + #[serde(rename = "serviceLevel", default, skip_serializing_if = "Option::is_none")] + pub service_level: Option, + #[serde(rename = "usageThreshold", default, skip_serializing_if = "Option::is_none")] + pub usage_threshold: Option, + #[serde(rename = "exportPolicy", default, skip_serializing_if = "Option::is_none")] + pub export_policy: Option, + #[serde(rename = "throughputMibps", default, skip_serializing_if = "Option::is_none")] + pub throughput_mibps: Option, + #[serde(rename = "dataProtection", default, skip_serializing_if = "Option::is_none")] + pub data_protection: Option, + #[serde(rename = "isDefaultQuotaEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_default_quota_enabled: Option, + #[serde(rename = "defaultUserQuotaInKiBs", default, skip_serializing_if = "Option::is_none")] + pub default_user_quota_in_ki_bs: Option, + #[serde(rename = "defaultGroupQuotaInKiBs", default, skip_serializing_if = "Option::is_none")] + pub default_group_quota_in_ki_bs: Option, +} +pub mod volume_patch_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ExportPolicy { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct DataProtection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub backup: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeProperties { + #[serde(rename = "fileSystemId", default, skip_serializing_if = "Option::is_none")] + pub file_system_id: Option, + #[serde(rename = "creationToken")] + pub creation_token: String, + #[serde(rename = "serviceLevel", default, skip_serializing_if = "Option::is_none")] + pub service_level: Option, + #[serde(rename = "usageThreshold")] + pub usage_threshold: i64, + #[serde(rename = "exportPolicy", default, skip_serializing_if = "Option::is_none")] + pub export_policy: Option, + #[serde(rename = "protocolTypes", default, skip_serializing_if = "Vec::is_empty")] + pub protocol_types: Vec, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "snapshotId", default, skip_serializing_if = "Option::is_none")] + pub snapshot_id: Option, + #[serde(rename = "backupId", default, skip_serializing_if = "Option::is_none")] + pub backup_id: Option, + #[serde(rename = "baremetalTenantId", default, skip_serializing_if = "Option::is_none")] + pub baremetal_tenant_id: Option, + #[serde(rename = "subnetId")] + pub subnet_id: String, + #[serde(rename = "networkFeatures", default, skip_serializing_if = "Option::is_none")] + pub network_features: Option, + #[serde(rename = "networkSiblingSetId", default, skip_serializing_if = "Option::is_none")] + pub network_sibling_set_id: Option, + #[serde(rename = "storageToNetworkProximity", default, skip_serializing_if = "Option::is_none")] + pub storage_to_network_proximity: Option, + #[serde(rename = "mountTargets", default, skip_serializing_if = "Vec::is_empty")] + pub mount_targets: Vec, + #[serde(rename = "volumeType", default, skip_serializing_if = "Option::is_none")] + pub volume_type: Option, + #[serde(rename = "dataProtection", default, skip_serializing_if = "Option::is_none")] + pub data_protection: Option, + #[serde(rename = "isRestoring", default, skip_serializing_if = "Option::is_none")] + pub is_restoring: Option, + #[serde(rename = "snapshotDirectoryVisible", default, skip_serializing_if = "Option::is_none")] + pub snapshot_directory_visible: Option, + #[serde(rename = "kerberosEnabled", default, skip_serializing_if = "Option::is_none")] + pub kerberos_enabled: Option, + #[serde(rename = "securityStyle", default, skip_serializing_if = "Option::is_none")] + pub security_style: Option, + #[serde(rename = "smbEncryption", default, skip_serializing_if = "Option::is_none")] + pub smb_encryption: Option, + #[serde(rename = "smbContinuouslyAvailable", default, skip_serializing_if = "Option::is_none")] + pub smb_continuously_available: Option, + #[serde(rename = "throughputMibps", default, skip_serializing_if = "Option::is_none")] + pub throughput_mibps: Option, + #[serde(rename = "encryptionKeySource", default, skip_serializing_if = "Option::is_none")] + pub encryption_key_source: Option, + #[serde(rename = "ldapEnabled", default, skip_serializing_if = "Option::is_none")] + pub ldap_enabled: Option, + #[serde(rename = "coolAccess", default, skip_serializing_if = "Option::is_none")] + pub cool_access: Option, + #[serde(rename = "coolnessPeriod", default, skip_serializing_if = "Option::is_none")] + pub coolness_period: Option, + #[serde(rename = "unixPermissions", default, skip_serializing_if = "Option::is_none")] + pub unix_permissions: Option, + #[serde(rename = "cloneProgress", default, skip_serializing_if = "Option::is_none")] + pub clone_progress: Option, + #[serde(rename = "avsDataStore", default, skip_serializing_if = "Option::is_none")] + pub avs_data_store: Option, + #[serde(rename = "isDefaultQuotaEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_default_quota_enabled: Option, + #[serde(rename = "defaultUserQuotaInKiBs", default, skip_serializing_if = "Option::is_none")] + pub default_user_quota_in_ki_bs: Option, + #[serde(rename = "defaultGroupQuotaInKiBs", default, skip_serializing_if = "Option::is_none")] + pub default_group_quota_in_ki_bs: Option, + #[serde(rename = "volumeGroupName", default, skip_serializing_if = "Option::is_none")] + pub volume_group_name: Option, + #[serde(rename = "capacityPoolResourceId", default, skip_serializing_if = "Option::is_none")] + pub capacity_pool_resource_id: Option, + #[serde(rename = "proximityPlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group: Option, + #[serde(rename = "t2Network", default, skip_serializing_if = "Option::is_none")] + pub t2_network: Option, + #[serde(rename = "volumeSpecName", default, skip_serializing_if = "Option::is_none")] + pub volume_spec_name: Option, + #[serde(rename = "placementRules", default, skip_serializing_if = "Vec::is_empty")] + pub placement_rules: Vec, +} +pub mod volume_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ExportPolicy { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkFeatures { + Basic, + Standard, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageToNetworkProximity { + Default, + T1, + T2, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct DataProtection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub backup: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub replication: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SecurityStyle { + #[serde(rename = "ntfs")] + Ntfs, + #[serde(rename = "unix")] + Unix, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AvsDataStore { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeRevert { + #[serde(rename = "snapshotId", default, skip_serializing_if = "Option::is_none")] + pub snapshot_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeSnapshotProperties { + #[serde(rename = "snapshotPolicyId", default, skip_serializing_if = "Option::is_none")] + pub snapshot_policy_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WeeklySchedule { + #[serde(rename = "snapshotsToKeep", default, skip_serializing_if = "Option::is_none")] + pub snapshots_to_keep: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hour: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minute: Option, + #[serde(rename = "usedBytes", default, skip_serializing_if = "Option::is_none")] + pub used_bytes: Option, +} diff --git a/services/mgmt/netapp/src/package_netapp_2021_08_01/operations.rs b/services/mgmt/netapp/src/package_netapp_2021_08_01/operations.rs new file mode 100644 index 0000000000..74a79a27c4 --- /dev/null +++ b/services/mgmt/netapp/src/package_netapp_2021_08_01/operations.rs @@ -0,0 +1,5565 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn account_backups(&self) -> account_backups::Client { + account_backups::Client(self.clone()) + } + pub fn accounts(&self) -> accounts::Client { + accounts::Client(self.clone()) + } + pub fn backup_policies(&self) -> backup_policies::Client { + backup_policies::Client(self.clone()) + } + pub fn backups(&self) -> backups::Client { + backups::Client(self.clone()) + } + pub fn net_app_resource(&self) -> net_app_resource::Client { + net_app_resource::Client(self.clone()) + } + pub fn net_app_resource_quota_limits(&self) -> net_app_resource_quota_limits::Client { + net_app_resource_quota_limits::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn pools(&self) -> pools::Client { + pools::Client(self.clone()) + } + pub fn snapshot_policies(&self) -> snapshot_policies::Client { + snapshot_policies::Client(self.clone()) + } + pub fn snapshots(&self) -> snapshots::Client { + snapshots::Client(self.clone()) + } + pub fn vaults(&self) -> vaults::Client { + vaults::Client(self.clone()) + } + pub fn volume_groups(&self) -> volume_groups::Client { + volume_groups::Client(self.clone()) + } + pub fn volumes(&self) -> volumes::Client { + volumes::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + NetAppResource_CheckNameAvailability(#[from] net_app_resource::check_name_availability::Error), + #[error(transparent)] + NetAppResource_CheckFilePathAvailability(#[from] net_app_resource::check_file_path_availability::Error), + #[error(transparent)] + NetAppResource_CheckQuotaAvailability(#[from] net_app_resource::check_quota_availability::Error), + #[error(transparent)] + NetAppResourceQuotaLimits_List(#[from] net_app_resource_quota_limits::list::Error), + #[error(transparent)] + NetAppResourceQuotaLimits_Get(#[from] net_app_resource_quota_limits::get::Error), + #[error(transparent)] + Accounts_ListBySubscription(#[from] accounts::list_by_subscription::Error), + #[error(transparent)] + Accounts_List(#[from] accounts::list::Error), + #[error(transparent)] + Accounts_Get(#[from] accounts::get::Error), + #[error(transparent)] + Accounts_CreateOrUpdate(#[from] accounts::create_or_update::Error), + #[error(transparent)] + Accounts_Update(#[from] accounts::update::Error), + #[error(transparent)] + Accounts_Delete(#[from] accounts::delete::Error), + #[error(transparent)] + Pools_List(#[from] pools::list::Error), + #[error(transparent)] + Pools_Get(#[from] pools::get::Error), + #[error(transparent)] + Pools_CreateOrUpdate(#[from] pools::create_or_update::Error), + #[error(transparent)] + Pools_Update(#[from] pools::update::Error), + #[error(transparent)] + Pools_Delete(#[from] pools::delete::Error), + #[error(transparent)] + Volumes_List(#[from] volumes::list::Error), + #[error(transparent)] + Volumes_Get(#[from] volumes::get::Error), + #[error(transparent)] + Volumes_CreateOrUpdate(#[from] volumes::create_or_update::Error), + #[error(transparent)] + Volumes_Update(#[from] volumes::update::Error), + #[error(transparent)] + Volumes_Delete(#[from] volumes::delete::Error), + #[error(transparent)] + Volumes_Revert(#[from] volumes::revert::Error), + #[error(transparent)] + Volumes_BreakReplication(#[from] volumes::break_replication::Error), + #[error(transparent)] + Volumes_ReplicationStatus(#[from] volumes::replication_status::Error), + #[error(transparent)] + Volumes_ResyncReplication(#[from] volumes::resync_replication::Error), + #[error(transparent)] + Volumes_DeleteReplication(#[from] volumes::delete_replication::Error), + #[error(transparent)] + Volumes_AuthorizeReplication(#[from] volumes::authorize_replication::Error), + #[error(transparent)] + Volumes_ReInitializeReplication(#[from] volumes::re_initialize_replication::Error), + #[error(transparent)] + Volumes_PoolChange(#[from] volumes::pool_change::Error), + #[error(transparent)] + Snapshots_List(#[from] snapshots::list::Error), + #[error(transparent)] + Snapshots_Get(#[from] snapshots::get::Error), + #[error(transparent)] + Snapshots_Create(#[from] snapshots::create::Error), + #[error(transparent)] + Snapshots_Update(#[from] snapshots::update::Error), + #[error(transparent)] + Snapshots_Delete(#[from] snapshots::delete::Error), + #[error(transparent)] + SnapshotPolicies_List(#[from] snapshot_policies::list::Error), + #[error(transparent)] + SnapshotPolicies_Get(#[from] snapshot_policies::get::Error), + #[error(transparent)] + SnapshotPolicies_Create(#[from] snapshot_policies::create::Error), + #[error(transparent)] + SnapshotPolicies_Update(#[from] snapshot_policies::update::Error), + #[error(transparent)] + SnapshotPolicies_Delete(#[from] snapshot_policies::delete::Error), + #[error(transparent)] + SnapshotPolicies_ListVolumes(#[from] snapshot_policies::list_volumes::Error), + #[error(transparent)] + Backups_GetStatus(#[from] backups::get_status::Error), + #[error(transparent)] + Backups_GetVolumeRestoreStatus(#[from] backups::get_volume_restore_status::Error), + #[error(transparent)] + AccountBackups_List(#[from] account_backups::list::Error), + #[error(transparent)] + AccountBackups_Get(#[from] account_backups::get::Error), + #[error(transparent)] + AccountBackups_Delete(#[from] account_backups::delete::Error), + #[error(transparent)] + Backups_List(#[from] backups::list::Error), + #[error(transparent)] + Backups_Get(#[from] backups::get::Error), + #[error(transparent)] + Backups_Create(#[from] backups::create::Error), + #[error(transparent)] + Backups_Update(#[from] backups::update::Error), + #[error(transparent)] + Backups_Delete(#[from] backups::delete::Error), + #[error(transparent)] + BackupPolicies_List(#[from] backup_policies::list::Error), + #[error(transparent)] + BackupPolicies_Get(#[from] backup_policies::get::Error), + #[error(transparent)] + BackupPolicies_Create(#[from] backup_policies::create::Error), + #[error(transparent)] + BackupPolicies_Update(#[from] backup_policies::update::Error), + #[error(transparent)] + BackupPolicies_Delete(#[from] backup_policies::delete::Error), + #[error(transparent)] + Vaults_List(#[from] vaults::list::Error), + #[error(transparent)] + VolumeGroups_ListByNetAppAccount(#[from] volume_groups::list_by_net_app_account::Error), + #[error(transparent)] + VolumeGroups_Get(#[from] volume_groups::get::Error), + #[error(transparent)] + VolumeGroups_Create(#[from] volume_groups::create::Error), + #[error(transparent)] + VolumeGroups_Delete(#[from] volume_groups::delete::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Describes the Resource Provider"] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.NetApp/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod net_app_resource { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Check resource name availability"] + pub fn check_name_availability( + &self, + body: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + #[doc = "Check file path availability"] + pub fn check_file_path_availability( + &self, + body: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> check_file_path_availability::Builder { + check_file_path_availability::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + #[doc = "Check quota availability"] + pub fn check_quota_availability( + &self, + body: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> check_quota_availability::Builder { + check_quota_availability::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::ResourceNameAvailabilityRequest, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.NetApp/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckAvailabilityResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod check_file_path_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::FilePathAvailabilityRequest, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.NetApp/locations/{}/checkFilePathAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckAvailabilityResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod check_quota_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::QuotaAvailabilityRequest, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.NetApp/locations/{}/checkQuotaAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckAvailabilityResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod net_app_resource_quota_limits { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get quota limits"] + pub fn list(&self, subscription_id: impl Into, location: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + #[doc = "Get quota limits"] + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + quota_limit_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + quota_limit_name: quota_limit_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.NetApp/locations/{}/quotaLimits", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionQuotaItemList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) quota_limit_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.NetApp/locations/{}/quotaLimits/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.quota_limit_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionQuotaItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod accounts { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Describe all NetApp Accounts in a subscription"] + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Describe all NetApp Accounts in a resource group"] + pub fn list(&self, subscription_id: impl Into, resource_group_name: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Describe a NetApp Account"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + #[doc = "Create or update a NetApp account"] + pub fn create_or_update( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + #[doc = "Update a NetApp account"] + pub fn update( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + #[doc = "Delete a NetApp account"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.NetApp/netAppAccounts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetAppAccountList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetAppAccountList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetAppAccount = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetAppAccount), + Created201(models::NetAppAccount), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::NetAppAccount, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetAppAccount = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetAppAccount = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetAppAccount), + Accepted202(models::NetAppAccount), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::NetAppAccountPatch, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetAppAccount = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetAppAccount = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod pools { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Describe all Capacity Pools"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + #[doc = "Describe a Capacity Pool"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + } + } + #[doc = "Create or Update the specified capacity pool within the resource group"] + pub fn create_or_update( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + } + } + #[doc = "Update a capacity pool"] + pub fn update( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + } + } + #[doc = "Delete a capacity pool"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityPoolList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CapacityPool), + Created201(models::CapacityPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::CapacityPool, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::CapacityPool), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::CapacityPoolPatch, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapacityPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod volumes { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Describe all volumes"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + } + } + #[doc = "Describe a volume"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Create or Update a volume"] + pub fn create_or_update( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Update a volume"] + pub fn update( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Delete a volume"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Revert a volume to one of its snapshots"] + pub fn revert( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + body: impl Into, + ) -> revert::Builder { + revert::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + body: body.into(), + } + } + #[doc = "Break volume replication"] + pub fn break_replication( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> break_replication::Builder { + break_replication::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + body: None, + } + } + #[doc = "Get volume replication status"] + pub fn replication_status( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> replication_status::Builder { + replication_status::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Resync volume replication"] + pub fn resync_replication( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> resync_replication::Builder { + resync_replication::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Delete volume replication"] + pub fn delete_replication( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> delete_replication::Builder { + delete_replication::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Authorize source volume replication"] + pub fn authorize_replication( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + body: impl Into, + ) -> authorize_replication::Builder { + authorize_replication::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + body: body.into(), + } + } + #[doc = "ReInitialize volume replication"] + pub fn re_initialize_replication( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> re_initialize_replication::Builder { + re_initialize_replication::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Change pool for volume"] + pub fn pool_change( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + body: impl Into, + ) -> pool_change::Builder { + pool_change::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + body: body.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name, + &self.volume_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Volume = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Volume), + Created201(models::Volume), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::Volume, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name, + &self.volume_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Volume = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Volume = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Volume), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::VolumePatch, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name, + &self.volume_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Volume = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.pool_name, + &self.volume_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod revert { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) body: models::VolumeRevert, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/revert" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod break_replication { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/breakReplication" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod replication_status { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/replicationStatus" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod resync_replication { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/resyncReplication" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete_replication { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/deleteReplication" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod authorize_replication { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) body: models::AuthorizeRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/authorizeReplication" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod re_initialize_replication { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/reinitializeReplication" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod pool_change { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) body: models::PoolChangeRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/poolChange" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod snapshots { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Describe all snapshots"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Describe a snapshot"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + snapshot_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + snapshot_name: snapshot_name.into(), + } + } + #[doc = "Create a snapshot"] + pub fn create( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + snapshot_name: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + snapshot_name: snapshot_name.into(), + } + } + #[doc = "Update a snapshot"] + pub fn update( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + snapshot_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + snapshot_name: snapshot_name.into(), + } + } + #[doc = "Delete a snapshot"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + snapshot_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + snapshot_name: snapshot_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/snapshots" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) snapshot_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/snapshots/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name , & self . snapshot_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Created201(models::Snapshot), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::Snapshot, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) snapshot_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/snapshots/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name , & self . snapshot_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::SnapshotPatch, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) snapshot_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/snapshots/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name , & self . snapshot_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) snapshot_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/snapshots/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name , & self . snapshot_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod snapshot_policies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + snapshot_policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + snapshot_policy_name: snapshot_policy_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + snapshot_policy_name: impl Into, + body: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + snapshot_policy_name: snapshot_policy_name.into(), + body: body.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + snapshot_policy_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + snapshot_policy_name: snapshot_policy_name.into(), + body: body.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + snapshot_policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + snapshot_policy_name: snapshot_policy_name.into(), + } + } + #[doc = "Get volumes for snapshot policy"] + pub fn list_volumes( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + snapshot_policy_name: impl Into, + ) -> list_volumes::Builder { + list_volumes::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + snapshot_policy_name: snapshot_policy_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/snapshotPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotPoliciesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) snapshot_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/snapshotPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.snapshot_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::SnapshotPolicy), + Created201(models::SnapshotPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) snapshot_policy_name: String, + pub(crate) body: models::SnapshotPolicy, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/snapshotPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.snapshot_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::SnapshotPolicy), + Accepted202(models::SnapshotPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) snapshot_policy_name: String, + pub(crate) body: models::SnapshotPolicyPatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/snapshotPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.snapshot_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) snapshot_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/snapshotPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.snapshot_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod list_volumes { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) snapshot_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/snapshotPolicies/{}/volumes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.snapshot_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotPolicyVolumeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod backups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get volume's backup status"] + pub fn get_status( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> get_status::Builder { + get_status::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Get volume's restore status"] + pub fn get_volume_restore_status( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> get_volume_restore_status::Builder { + get_volume_restore_status::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "List Backups"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + } + } + #[doc = "Get a backup"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + backup_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + backup_name: backup_name.into(), + } + } + #[doc = "Create a backup"] + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + backup_name: impl Into, + body: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + backup_name: backup_name.into(), + body: body.into(), + } + } + #[doc = "Patch a backup"] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + backup_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + backup_name: backup_name.into(), + body: None, + } + } + #[doc = "Delete backup"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + pool_name: impl Into, + volume_name: impl Into, + backup_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + pool_name: pool_name.into(), + volume_name: volume_name.into(), + backup_name: backup_name.into(), + } + } + } + pub mod get_status { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/backupStatus" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get_volume_restore_status { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/restoreStatus" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestoreStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/backups" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) backup_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/backups/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name , & self . backup_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Backup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Backup), + Created201(models::Backup), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) backup_name: String, + pub(crate) body: models::Backup, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/backups/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name , & self . backup_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Backup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Backup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Backup), + Accepted202(models::Backup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) backup_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/backups/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name , & self . backup_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Backup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Backup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) pool_name: String, + pub(crate) volume_name: String, + pub(crate) backup_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/capacityPools/{}/volumes/{}/backups/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . pool_name , & self . volume_name , & self . backup_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod account_backups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List Backups for a Netapp Account"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + #[doc = "Get Backup for a Netapp Account"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + backup_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + backup_name: backup_name.into(), + } + } + #[doc = "Delete Backup for a Netapp Account"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + backup_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + backup_name: backup_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/accountBackups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) backup_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/accountBackups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.backup_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Backup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) backup_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/accountBackups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.backup_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod backup_policies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List backup policies"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + #[doc = "Get a backup Policy"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + backup_policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + backup_policy_name: backup_policy_name.into(), + } + } + #[doc = "Create a backup policy"] + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + backup_policy_name: impl Into, + body: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + backup_policy_name: backup_policy_name.into(), + body: body.into(), + } + } + #[doc = "Patch a backup policy"] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + backup_policy_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + backup_policy_name: backup_policy_name.into(), + body: body.into(), + } + } + #[doc = "Delete a backup policy"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + backup_policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + backup_policy_name: backup_policy_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/backupPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupPoliciesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) backup_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupPolicy), + Created201(models::BackupPolicy), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) backup_policy_name: String, + pub(crate) body: models::BackupPolicy, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupPolicy), + Accepted202(models::BackupPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) backup_policy_name: String, + pub(crate) body: models::BackupPolicyPatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) backup_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod vaults { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List vaults"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/vaults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod volume_groups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Describe all volume groups"] + pub fn list_by_net_app_account( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_by_net_app_account::Builder { + list_by_net_app_account::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + #[doc = "Describe a Volume Group"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + volume_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + volume_group_name: volume_group_name.into(), + } + } + #[doc = "Create the specified volume group and volumes. Creating volume group will create all the volumes specified in request body implicitly. Once volumes are created using volume group, those will be treated as regular volumes thereafter."] + pub fn create( + &self, + body: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + volume_group_name: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + body: body.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + volume_group_name: volume_group_name.into(), + } + } + #[doc = "Delete a volume group"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + volume_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + volume_group_name: volume_group_name.into(), + } + } + } + pub mod list_by_net_app_account { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/volumeGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeGroupList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) volume_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/volumeGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.volume_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeGroupDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::VolumeGroupDetails, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) volume_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/volumeGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.volume_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeGroupDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) volume_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NetApp/netAppAccounts/{}/volumeGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.volume_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} diff --git a/services/mgmt/notificationhubs/src/package_2017_04/operations.rs b/services/mgmt/notificationhubs/src/package_2017_04/operations.rs index 00267e5015..01b207c324 100644 --- a/services/mgmt/notificationhubs/src/package_2017_04/operations.rs +++ b/services/mgmt/notificationhubs/src/package_2017_04/operations.rs @@ -1249,10 +1249,7 @@ pub mod namespaces { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> - { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.NotificationHubs/namespaces/{}/AuthorizationRules/{}/listKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . authorization_rule_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; @@ -1274,7 +1271,7 @@ pub mod namespaces { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SharedAccessAuthorizationRuleListResult = + let rsp_value: models::ResourceListKeys = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/oep/Cargo.toml b/services/mgmt/oep/Cargo.toml new file mode 100644 index 0000000000..e3f21f43b7 --- /dev/null +++ b/services/mgmt/oep/Cargo.toml @@ -0,0 +1,26 @@ +# generated by AutoRust 0.1.0 +[package] +name = "azure_mgmt_oep" +version = "0.1.0" +edition = "2018" + +[dependencies] +azure_core = { path = "../../../sdk/core", version = "0.1.0", default-features = false } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +bytes = "1.0" +thiserror = "1.0" +http = "0.2" +url = "2.2" +futures = "0.3" + +[dev-dependencies] +azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } +tokio = { version = "1.0", features = ["macros"] } + +[features] +default = ["package-2021-06-01-preview", "enable_reqwest"] +enable_reqwest = ["azure_core/enable_reqwest"] +enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] +no-default-version = [] +"package-2021-06-01-preview" = [] diff --git a/services/mgmt/oep/src/lib.rs b/services/mgmt/oep/src/lib.rs new file mode 100644 index 0000000000..51f1b7d27d --- /dev/null +++ b/services/mgmt/oep/src/lib.rs @@ -0,0 +1,9 @@ +#![allow(clippy::module_inception)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::ptr_arg)] +#![allow(clippy::large_enum_variant)] +#![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-06-01-preview")] +pub mod package_2021_06_01_preview; +#[cfg(all(feature = "package-2021-06-01-preview", not(feature = "no-default-version")))] +pub use package_2021_06_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/oep/src/package_2021_06_01_preview/mod.rs b/services/mgmt/oep/src/package_2021_06_01_preview/mod.rs new file mode 100644 index 0000000000..616b19d2cf --- /dev/null +++ b/services/mgmt/oep/src/package_2021_06_01_preview/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-06-01-preview"; diff --git a/services/mgmt/oep/src/package_2021_06_01_preview/models.rs b/services/mgmt/oep/src/package_2021_06_01_preview/models.rs new file mode 100644 index 0000000000..f8b1222501 --- /dev/null +++ b/services/mgmt/oep/src/package_2021_06_01_preview/models.rs @@ -0,0 +1,194 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityResponse { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +pub mod check_name_availability_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Reason { + Invalid, + AlreadyExists, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataPartitionNames { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnergyResourceUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnergyService { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnergyServiceList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnergyServiceProperties { + #[serde(rename = "dnsName", default, skip_serializing_if = "Option::is_none")] + pub dns_name: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "authAppId", default, skip_serializing_if = "Option::is_none")] + pub auth_app_id: Option, + #[serde(rename = "dataPartitionNames", default, skip_serializing_if = "Vec::is_empty")] + pub data_partition_names: Vec, +} +pub mod energy_service_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Unknown, + Succeeded, + Failed, + Canceled, + Creating, + Deleting, + Updating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + #[serde(rename = "user")] + User, + #[serde(rename = "system")] + System, + #[serde(rename = "user,system")] + UserSystem, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/oep/src/package_2021_06_01_preview/operations.rs b/services/mgmt/oep/src/package_2021_06_01_preview/operations.rs new file mode 100644 index 0000000000..fe469bc5f0 --- /dev/null +++ b/services/mgmt/oep/src/package_2021_06_01_preview/operations.rs @@ -0,0 +1,788 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn energy_services(&self) -> energy_services::Client { + energy_services::Client(self.clone()) + } + pub fn locations(&self) -> locations::Client { + locations::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Locations_CheckNameAvailability(#[from] locations::check_name_availability::Error), + #[error(transparent)] + EnergyServices_ListByResourceGroup(#[from] energy_services::list_by_resource_group::Error), + #[error(transparent)] + EnergyServices_ListBySubscription(#[from] energy_services::list_by_subscription::Error), + #[error(transparent)] + EnergyServices_Get(#[from] energy_services::get::Error), + #[error(transparent)] + EnergyServices_Create(#[from] energy_services::create::Error), + #[error(transparent)] + EnergyServices_Update(#[from] energy_services::update::Error), + #[error(transparent)] + EnergyServices_Delete(#[from] energy_services::delete::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), +} +pub mod locations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + subscription_id: impl Into, + body: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + body: body.into(), + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) body: models::CheckNameAvailabilityRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.OpenEnergyPlatform/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod energy_services { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + body: None, + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + body: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.OpenEnergyPlatform/energyServices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EnergyServiceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.OpenEnergyPlatform/energyServices", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EnergyServiceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.OpenEnergyPlatform/energyServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EnergyService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::EnergyService), + Created201(models::EnergyService), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.OpenEnergyPlatform/energyServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EnergyService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EnergyService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.OpenEnergyPlatform/energyServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EnergyService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.OpenEnergyPlatform/energyServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.OpenEnergyPlatform/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/operationalinsights/src/package_2021_06/models.rs b/services/mgmt/operationalinsights/src/package_2021_06/models.rs index 115f96629d..7334120b5d 100644 --- a/services/mgmt/operationalinsights/src/package_2021_06/models.rs +++ b/services/mgmt/operationalinsights/src/package_2021_06/models.rs @@ -646,6 +646,29 @@ pub mod storage_insight_status { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Table { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableProperties { + #[serde(rename = "retentionInDays", default, skip_serializing_if = "Option::is_none")] + pub retention_in_days: Option, + #[serde(rename = "isTroubleshootingAllowed", default, skip_serializing_if = "Option::is_none")] + pub is_troubleshooting_allowed: Option, + #[serde(rename = "isTroubleshootEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_troubleshoot_enabled: Option, + #[serde(rename = "lastTroubleshootDate", default, skip_serializing_if = "Option::is_none")] + pub last_troubleshoot_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TablesListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Tag { pub name: String, pub value: String, diff --git a/services/mgmt/operationalinsights/src/package_2021_06/operations.rs b/services/mgmt/operationalinsights/src/package_2021_06/operations.rs index 0c5d86a451..6cedd99400 100644 --- a/services/mgmt/operationalinsights/src/package_2021_06/operations.rs +++ b/services/mgmt/operationalinsights/src/package_2021_06/operations.rs @@ -122,6 +122,9 @@ impl Client { pub fn storage_insight_configs(&self) -> storage_insight_configs::Client { storage_insight_configs::Client(self.clone()) } + pub fn tables(&self) -> tables::Client { + tables::Client(self.clone()) + } pub fn usages(&self) -> usages::Client { usages::Client(self.clone()) } @@ -213,6 +216,14 @@ pub enum Error { #[error(transparent)] Operations_List(#[from] operations::list::Error), #[error(transparent)] + Tables_ListByWorkspace(#[from] tables::list_by_workspace::Error), + #[error(transparent)] + Tables_Get(#[from] tables::get::Error), + #[error(transparent)] + Tables_Create(#[from] tables::create::Error), + #[error(transparent)] + Tables_Update(#[from] tables::update::Error), + #[error(transparent)] Clusters_ListByResourceGroup(#[from] clusters::list_by_resource_group::Error), #[error(transparent)] Clusters_List(#[from] clusters::list::Error), @@ -3691,6 +3702,392 @@ pub mod operations { } } } +pub mod tables { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_workspace( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + ) -> list_by_workspace::Builder { + list_by_workspace::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + table_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + table_name: table_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + table_name: impl Into, + parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + table_name: table_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + table_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + table_name: table_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list_by_workspace { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}/tables", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TablesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}/tables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Table = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + pub(crate) table_name: String, + pub(crate) parameters: models::Table, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}/tables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Table = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + pub(crate) table_name: String, + pub(crate) parameters: models::Table, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}/tables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Table = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} pub mod clusters { use super::{models, API_VERSION}; pub struct Client(pub(crate) super::Client); diff --git a/services/mgmt/orbital/Cargo.toml b/services/mgmt/orbital/Cargo.toml new file mode 100644 index 0000000000..5210dc755f --- /dev/null +++ b/services/mgmt/orbital/Cargo.toml @@ -0,0 +1,26 @@ +# generated by AutoRust 0.1.0 +[package] +name = "azure_mgmt_orbital" +version = "0.1.0" +edition = "2018" + +[dependencies] +azure_core = { path = "../../../sdk/core", version = "0.1.0", default-features = false } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +bytes = "1.0" +thiserror = "1.0" +http = "0.2" +url = "2.2" +futures = "0.3" + +[dev-dependencies] +azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } +tokio = { version = "1.0", features = ["macros"] } + +[features] +default = ["package-2021-04-04-preview", "enable_reqwest"] +enable_reqwest = ["azure_core/enable_reqwest"] +enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] +no-default-version = [] +"package-2021-04-04-preview" = [] diff --git a/services/mgmt/orbital/src/lib.rs b/services/mgmt/orbital/src/lib.rs new file mode 100644 index 0000000000..cc13973661 --- /dev/null +++ b/services/mgmt/orbital/src/lib.rs @@ -0,0 +1,9 @@ +#![allow(clippy::module_inception)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::ptr_arg)] +#![allow(clippy::large_enum_variant)] +#![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-04-04-preview")] +pub mod package_2021_04_04_preview; +#[cfg(all(feature = "package-2021-04-04-preview", not(feature = "no-default-version")))] +pub use package_2021_04_04_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/orbital/src/package_2021_04_04_preview/mod.rs b/services/mgmt/orbital/src/package_2021_04_04_preview/mod.rs new file mode 100644 index 0000000000..05111a28d0 --- /dev/null +++ b/services/mgmt/orbital/src/package_2021_04_04_preview/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-04-04-preview"; diff --git a/services/mgmt/orbital/src/package_2021_04_04_preview/models.rs b/services/mgmt/orbital/src/package_2021_04_04_preview/models.rs new file mode 100644 index 0000000000..f1cb78801c --- /dev/null +++ b/services/mgmt/orbital/src/package_2021_04_04_preview/models.rs @@ -0,0 +1,475 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableContacts { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub spacecraft: Option, + #[serde(rename = "groundStationName", default, skip_serializing_if = "Option::is_none")] + pub ground_station_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableContactsListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableGroundStation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableGroundStationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableGroundStationProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, + #[serde(rename = "providerName", default, skip_serializing_if = "Option::is_none")] + pub provider_name: Option, + #[serde(rename = "longitudeDegrees", default, skip_serializing_if = "Option::is_none")] + pub longitude_degrees: Option, + #[serde(rename = "latitudeDegrees", default, skip_serializing_if = "Option::is_none")] + pub latitude_degrees: Option, + #[serde(rename = "altitudeMeters", default, skip_serializing_if = "Option::is_none")] + pub altitude_meters: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Capability { + EarthObservation, + Communication, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Contact { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactInstanceProperties { + #[serde(rename = "maximumElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub maximum_elevation_degrees: Option, + #[serde(rename = "txStartTime", default, skip_serializing_if = "Option::is_none")] + pub tx_start_time: Option, + #[serde(rename = "txEndTime", default, skip_serializing_if = "Option::is_none")] + pub tx_end_time: Option, + #[serde(rename = "rxStartTime", default, skip_serializing_if = "Option::is_none")] + pub rx_start_time: Option, + #[serde(rename = "rxEndTime", default, skip_serializing_if = "Option::is_none")] + pub rx_end_time: Option, + #[serde(rename = "startAzimuthDegrees", default, skip_serializing_if = "Option::is_none")] + pub start_azimuth_degrees: Option, + #[serde(rename = "endAzimuthDegrees", default, skip_serializing_if = "Option::is_none")] + pub end_azimuth_degrees: Option, + #[serde(rename = "startElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub start_elevation_degrees: Option, + #[serde(rename = "endElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub end_elevation_degrees: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactParameters { + #[serde(rename = "contactProfile")] + pub contact_profile: ResourceReference, + #[serde(rename = "groundStationName")] + pub ground_station_name: String, + #[serde(rename = "startTime")] + pub start_time: String, + #[serde(rename = "endTime")] + pub end_time: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfile { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfileLink { + pub polarization: contact_profile_link::Polarization, + pub direction: contact_profile_link::Direction, + #[serde(rename = "gainOverTemperature", default, skip_serializing_if = "Option::is_none")] + pub gain_over_temperature: Option, + #[serde(rename = "eirpdBW", default, skip_serializing_if = "Option::is_none")] + pub eirpd_bw: Option, + pub channels: Vec, +} +pub mod contact_profile_link { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Polarization { + #[serde(rename = "RHCP")] + Rhcp, + #[serde(rename = "LHCP")] + Lhcp, + #[serde(rename = "dualRhcpLhcp")] + DualRhcpLhcp, + #[serde(rename = "linearVertical")] + LinearVertical, + #[serde(rename = "linearHorizontal")] + LinearHorizontal, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Direction { + #[serde(rename = "uplink")] + Uplink, + #[serde(rename = "downlink")] + Downlink, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfileLinkChannel { + #[serde(rename = "centerFrequencyMHz")] + pub center_frequency_m_hz: f64, + #[serde(rename = "bandwidthMHz")] + pub bandwidth_m_hz: f64, + #[serde(rename = "endPoint")] + pub end_point: EndPoint, + #[serde(rename = "modulationConfiguration", default, skip_serializing_if = "Option::is_none")] + pub modulation_configuration: Option, + #[serde(rename = "demodulationConfiguration", default, skip_serializing_if = "Option::is_none")] + pub demodulation_configuration: Option, + #[serde(rename = "encodingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub encoding_configuration: Option, + #[serde(rename = "decodingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub decoding_configuration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfileListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfilesProperties { + #[serde(rename = "minimumViableContactDuration", default, skip_serializing_if = "Option::is_none")] + pub minimum_viable_contact_duration: Option, + #[serde(rename = "minimumElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub minimum_elevation_degrees: Option, + #[serde(rename = "autoTrackingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub auto_tracking_configuration: Option, + #[serde(rename = "eventHubUri", default, skip_serializing_if = "Option::is_none")] + pub event_hub_uri: Option, + pub links: Vec, +} +pub mod contact_profiles_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoTrackingConfiguration { + #[serde(rename = "disabled")] + Disabled, + #[serde(rename = "xBand")] + XBand, + #[serde(rename = "sBand")] + SBand, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactsProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "reservationStartTime")] + pub reservation_start_time: String, + #[serde(rename = "reservationEndTime")] + pub reservation_end_time: String, + #[serde(rename = "rxStartTime", default, skip_serializing_if = "Option::is_none")] + pub rx_start_time: Option, + #[serde(rename = "rxEndTime", default, skip_serializing_if = "Option::is_none")] + pub rx_end_time: Option, + #[serde(rename = "txStartTime", default, skip_serializing_if = "Option::is_none")] + pub tx_start_time: Option, + #[serde(rename = "txEndTime", default, skip_serializing_if = "Option::is_none")] + pub tx_end_time: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "maximumElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub maximum_elevation_degrees: Option, + #[serde(rename = "startAzimuthDegrees", default, skip_serializing_if = "Option::is_none")] + pub start_azimuth_degrees: Option, + #[serde(rename = "endAzimuthDegrees", default, skip_serializing_if = "Option::is_none")] + pub end_azimuth_degrees: Option, + #[serde(rename = "groundStationName")] + pub ground_station_name: String, + #[serde(rename = "startElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub start_elevation_degrees: Option, + #[serde(rename = "endElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub end_elevation_degrees: Option, + #[serde(rename = "contactProfile")] + pub contact_profile: ResourceReference, +} +pub mod contacts_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "scheduled")] + Scheduled, + #[serde(rename = "cancelled")] + Cancelled, + #[serde(rename = "succeeded")] + Succeeded, + #[serde(rename = "failed")] + Failed, + #[serde(rename = "providerCancelled")] + ProviderCancelled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndPoint { + #[serde(rename = "ipAddress")] + pub ip_address: String, + #[serde(rename = "endPointName")] + pub end_point_name: String, + pub port: String, + pub protocol: end_point::Protocol, +} +pub mod end_point { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "UDP")] + Udp, + } +} +pub type Etag = String; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + #[serde(rename = "user")] + User, + #[serde(rename = "system")] + System, + #[serde(rename = "user,system")] + UserSystem, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceIdListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceReference { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Spacecraft { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SpacecraftLink { + #[serde(rename = "centerFrequencyMHz")] + pub center_frequency_m_hz: f64, + #[serde(rename = "bandwidthMHz")] + pub bandwidth_m_hz: f64, + pub direction: spacecraft_link::Direction, + pub polarization: spacecraft_link::Polarization, +} +pub mod spacecraft_link { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Direction { + #[serde(rename = "uplink")] + Uplink, + #[serde(rename = "downlink")] + Downlink, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Polarization { + #[serde(rename = "RHCP")] + Rhcp, + #[serde(rename = "LHCP")] + Lhcp, + #[serde(rename = "dualRhcpLhcp")] + DualRhcpLhcp, + #[serde(rename = "linearVertical")] + LinearVertical, + #[serde(rename = "linearHorizontal")] + LinearHorizontal, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SpacecraftListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SpacecraftsProperties { + #[serde(rename = "noradId")] + pub norad_id: String, + #[serde(rename = "authorizationStatus", default, skip_serializing_if = "Option::is_none")] + pub authorization_status: Option, + #[serde(rename = "authorizationStatusExtended", default, skip_serializing_if = "Option::is_none")] + pub authorization_status_extended: Option, + #[serde(rename = "titleLine", default, skip_serializing_if = "Option::is_none")] + pub title_line: Option, + #[serde(rename = "tleLine1", default, skip_serializing_if = "Option::is_none")] + pub tle_line1: Option, + #[serde(rename = "tleLine2", default, skip_serializing_if = "Option::is_none")] + pub tle_line2: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub links: Vec, +} +pub mod spacecrafts_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthorizationStatus { + Allowed, + Pending, + Denied, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagsObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/orbital/src/package_2021_04_04_preview/operations.rs b/services/mgmt/orbital/src/package_2021_04_04_preview/operations.rs new file mode 100644 index 0000000000..ee86fb3bf9 --- /dev/null +++ b/services/mgmt/orbital/src/package_2021_04_04_preview/operations.rs @@ -0,0 +1,1977 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn available_ground_stations(&self) -> available_ground_stations::Client { + available_ground_stations::Client(self.clone()) + } + pub fn contact_profiles(&self) -> contact_profiles::Client { + contact_profiles::Client(self.clone()) + } + pub fn contacts(&self) -> contacts::Client { + contacts::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn spacecrafts(&self) -> spacecrafts::Client { + spacecrafts::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Spacecrafts_ListBySubscription(#[from] spacecrafts::list_by_subscription::Error), + #[error(transparent)] + Spacecrafts_List(#[from] spacecrafts::list::Error), + #[error(transparent)] + Spacecrafts_Get(#[from] spacecrafts::get::Error), + #[error(transparent)] + Spacecrafts_CreateOrUpdate(#[from] spacecrafts::create_or_update::Error), + #[error(transparent)] + Spacecrafts_UpdateTags(#[from] spacecrafts::update_tags::Error), + #[error(transparent)] + Spacecrafts_Delete(#[from] spacecrafts::delete::Error), + #[error(transparent)] + Contacts_List(#[from] contacts::list::Error), + #[error(transparent)] + Contacts_Get(#[from] contacts::get::Error), + #[error(transparent)] + Contacts_Create(#[from] contacts::create::Error), + #[error(transparent)] + Contacts_Delete(#[from] contacts::delete::Error), + #[error(transparent)] + Spacecrafts_ListAvailableContacts(#[from] spacecrafts::list_available_contacts::Error), + #[error(transparent)] + ContactProfiles_Get(#[from] contact_profiles::get::Error), + #[error(transparent)] + ContactProfiles_CreateOrUpdate(#[from] contact_profiles::create_or_update::Error), + #[error(transparent)] + ContactProfiles_UpdateTags(#[from] contact_profiles::update_tags::Error), + #[error(transparent)] + ContactProfiles_Delete(#[from] contact_profiles::delete::Error), + #[error(transparent)] + ContactProfiles_ListBySubscription(#[from] contact_profiles::list_by_subscription::Error), + #[error(transparent)] + ContactProfiles_List(#[from] contact_profiles::list::Error), + #[error(transparent)] + AvailableGroundStations_ListByCapability(#[from] available_ground_stations::list_by_capability::Error), + #[error(transparent)] + AvailableGroundStations_Get(#[from] available_ground_stations::get::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Orbital/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod spacecrafts { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into, resource_group_name: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + parameters: parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + } + } + pub fn list_available_contacts( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + parameters: impl Into, + ) -> list_available_contacts::Builder { + list_available_contacts::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/spacecrafts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SpacecraftListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SpacecraftListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Spacecraft = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Spacecraft), + Created201(models::Spacecraft), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + pub(crate) parameters: models::Spacecraft, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Spacecraft = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Spacecraft = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Spacecraft = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_contacts { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + pub(crate) parameters: models::ContactParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/listAvailableContacts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableContactsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod contacts { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + contact_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + contact_name: contact_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + contact_name: impl Into, + parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + contact_name: contact_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + spacecraft_name: impl Into, + contact_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + spacecraft_name: spacecraft_name.into(), + contact_name: contact_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/contacts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + pub(crate) contact_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/contacts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name, + &self.contact_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Contact = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Contact), + Created201(models::Contact), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + pub(crate) contact_name: String, + pub(crate) parameters: models::Contact, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/contacts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name, + &self.contact_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Contact = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Contact = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) spacecraft_name: String, + pub(crate) contact_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/contacts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name, + &self.contact_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod contact_profiles { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + contact_profile_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + contact_profile_name: contact_profile_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + contact_profile_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + contact_profile_name: contact_profile_name.into(), + parameters: parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + parameters: impl Into, + contact_profile_name: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + parameters: parameters.into(), + contact_profile_name: contact_profile_name.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + contact_profile_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + contact_profile_name: contact_profile_name.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into, resource_group_name: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) contact_profile_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.contact_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ContactProfile), + Created201(models::ContactProfile), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) contact_profile_name: String, + pub(crate) parameters: models::ContactProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.contact_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) contact_profile_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.contact_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) contact_profile_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.contact_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/contactProfiles", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod available_ground_stations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_capability(&self, subscription_id: impl Into, capability: impl Into) -> list_by_capability::Builder { + list_by_capability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + capability: capability.into(), + } + } + pub fn get(&self, subscription_id: impl Into, ground_station_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + ground_station_name: ground_station_name.into(), + } + } + } + pub mod list_by_capability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) capability: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/availableGroundStations", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let capability = &self.capability; + url.query_pairs_mut().append_pair("capability", capability); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableGroundStationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) ground_station_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/availableGroundStations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.ground_station_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableGroundStation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/purview/src/package_2021_07_01/models.rs b/services/mgmt/purview/src/package_2021_07_01/models.rs index 523264771a..15e91ed34a 100644 --- a/services/mgmt/purview/src/package_2021_07_01/models.rs +++ b/services/mgmt/purview/src/package_2021_07_01/models.rs @@ -97,6 +97,8 @@ pub mod account_sku { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AccountUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -192,12 +194,16 @@ pub struct Identity { pub tenant_id: Option, #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, } pub mod identity { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum Type { + None, SystemAssigned, + UserAssigned, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -424,3 +430,10 @@ pub struct TrackedResource { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, } +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentity { + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, +} diff --git a/services/mgmt/recoveryservices/Cargo.toml b/services/mgmt/recoveryservices/Cargo.toml index 1560bfe4a5..b6b318fdc0 100644 --- a/services/mgmt/recoveryservices/Cargo.toml +++ b/services/mgmt/recoveryservices/Cargo.toml @@ -23,6 +23,7 @@ default = ["package-2021-08", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-preview-2021-11" = [] "package-2021-08" = [] "package-2021-07" = [] "package-2021-06" = [] diff --git a/services/mgmt/recoveryservices/src/lib.rs b/services/mgmt/recoveryservices/src/lib.rs index ed8d29ef97..5b92095ca1 100644 --- a/services/mgmt/recoveryservices/src/lib.rs +++ b/services/mgmt/recoveryservices/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-preview-2021-11")] +pub mod package_preview_2021_11; +#[cfg(all(feature = "package-preview-2021-11", not(feature = "no-default-version")))] +pub use package_preview_2021_11::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-08")] pub mod package_2021_08; #[cfg(all(feature = "package-2021-08", not(feature = "no-default-version")))] diff --git a/services/mgmt/recoveryservices/src/package_preview_2021_11/mod.rs b/services/mgmt/recoveryservices/src/package_preview_2021_11/mod.rs new file mode 100644 index 0000000000..75f67dfde9 --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_preview_2021_11/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-11-01-preview"; diff --git a/services/mgmt/recoveryservices/src/package_preview_2021_11/models.rs b/services/mgmt/recoveryservices/src/package_preview_2021_11/models.rs new file mode 100644 index 0000000000..f24584b932 --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_preview_2021_11/models.rs @@ -0,0 +1,649 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityParameters { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityResult { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForLogSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForProperties { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForServiceSpecification { + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryValueForSingleApi { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CmkKekIdentity { + #[serde(rename = "useSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub use_system_assigned_identity: Option, + #[serde(rename = "userAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CmkKeyVaultProperties { + #[serde(rename = "keyUri", default, skip_serializing_if = "Option::is_none")] + pub key_uri: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Error { + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityData { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type")] + pub type_: identity_data::Type, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod identity_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + None, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobsSummary { + #[serde(rename = "failedJobs", default, skip_serializing_if = "Option::is_none")] + pub failed_jobs: Option, + #[serde(rename = "suspendedJobs", default, skip_serializing_if = "Option::is_none")] + pub suspended_jobs: Option, + #[serde(rename = "inProgressJobs", default, skip_serializing_if = "Option::is_none")] + pub in_progress_jobs: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringSummary { + #[serde(rename = "unHealthyVmCount", default, skip_serializing_if = "Option::is_none")] + pub un_healthy_vm_count: Option, + #[serde(rename = "unHealthyProviderCount", default, skip_serializing_if = "Option::is_none")] + pub un_healthy_provider_count: Option, + #[serde(rename = "eventsCount", default, skip_serializing_if = "Option::is_none")] + pub events_count: Option, + #[serde(rename = "deprecatedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub deprecated_provider_count: Option, + #[serde(rename = "supportedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub supported_provider_count: Option, + #[serde(rename = "unsupportedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub unsupported_provider_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NameInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResource { + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PatchTrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PatchVault { + #[serde(flatten)] + pub patch_tracked_resource: PatchTrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, +} +pub mod private_endpoint_connection { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Deleting, + Failed, + Pending, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionVaultProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceProperties { + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResources { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RawCertificateData { + #[serde(rename = "authType", default, skip_serializing_if = "Option::is_none")] + pub auth_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, +} +pub mod raw_certificate_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthType { + Invalid, + #[serde(rename = "ACS")] + Acs, + #[serde(rename = "AAD")] + Aad, + AccessControlService, + AzureActiveDirectory, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationUsage { + #[serde(rename = "monitoringSummary", default, skip_serializing_if = "Option::is_none")] + pub monitoring_summary: Option, + #[serde(rename = "jobsSummary", default, skip_serializing_if = "Option::is_none")] + pub jobs_summary: Option, + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[serde(rename = "recoveryPlanCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_plan_count: Option, + #[serde(rename = "registeredServersCount", default, skip_serializing_if = "Option::is_none")] + pub registered_servers_count: Option, + #[serde(rename = "recoveryServicesProviderAuthType", default, skip_serializing_if = "Option::is_none")] + pub recovery_services_provider_auth_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationUsageList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateAndAadDetails { + #[serde(flatten)] + pub resource_certificate_details: ResourceCertificateDetails, + #[serde(rename = "aadAuthority")] + pub aad_authority: String, + #[serde(rename = "aadTenantId")] + pub aad_tenant_id: String, + #[serde(rename = "servicePrincipalClientId")] + pub service_principal_client_id: String, + #[serde(rename = "servicePrincipalObjectId")] + pub service_principal_object_id: String, + #[serde(rename = "azureManagementEndpointAudience")] + pub azure_management_endpoint_audience: String, + #[serde(rename = "serviceResourceId", default, skip_serializing_if = "Option::is_none")] + pub service_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateAndAcsDetails { + #[serde(flatten)] + pub resource_certificate_details: ResourceCertificateDetails, + #[serde(rename = "globalAcsNamespace")] + pub global_acs_namespace: String, + #[serde(rename = "globalAcsHostName")] + pub global_acs_host_name: String, + #[serde(rename = "globalAcsRPRealm")] + pub global_acs_rp_realm: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateDetails { + #[serde(rename = "authType")] + pub auth_type: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub issuer: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subject: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, + #[serde(rename = "validFrom", default, skip_serializing_if = "Option::is_none")] + pub valid_from: Option, + #[serde(rename = "validTo", default, skip_serializing_if = "Option::is_none")] + pub valid_to: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + pub name: sku::Name, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +pub mod sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Standard, + #[serde(rename = "RS0")] + Rs0, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradeDetails { + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[serde(rename = "lastUpdatedTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time_utc: Option, + #[serde(rename = "endTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub end_time_utc: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "triggerType", default, skip_serializing_if = "Option::is_none")] + pub trigger_type: Option, + #[serde(rename = "upgradedResourceId", default, skip_serializing_if = "Option::is_none")] + pub upgraded_resource_id: Option, + #[serde(rename = "previousResourceId", default, skip_serializing_if = "Option::is_none")] + pub previous_resource_id: Option, +} +pub mod upgrade_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Unknown, + InProgress, + Upgraded, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggerType { + UserTriggered, + ForcedUpgrade, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Vault { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultCertificateResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultExtendedInfo { + #[serde(rename = "integrityKey", default, skip_serializing_if = "Option::is_none")] + pub integrity_key: Option, + #[serde(rename = "encryptionKey", default, skip_serializing_if = "Option::is_none")] + pub encryption_key: Option, + #[serde(rename = "encryptionKeyThumbprint", default, skip_serializing_if = "Option::is_none")] + pub encryption_key_thumbprint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub algorithm: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultExtendedInfoResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "upgradeDetails", default, skip_serializing_if = "Option::is_none")] + pub upgrade_details: Option, + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[serde(rename = "privateEndpointStateForBackup", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_state_for_backup: Option, + #[serde(rename = "privateEndpointStateForSiteRecovery", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_state_for_site_recovery: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "moveDetails", default, skip_serializing_if = "Option::is_none")] + pub move_details: Option, + #[serde(rename = "moveState", default, skip_serializing_if = "Option::is_none")] + pub move_state: Option, + #[serde(rename = "backupStorageVersion", default, skip_serializing_if = "Option::is_none")] + pub backup_storage_version: Option, +} +pub mod vault_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateEndpointStateForBackup { + None, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateEndpointStateForSiteRecovery { + None, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Encryption { + #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] + pub key_vault_properties: Option, + #[serde(rename = "kekIdentity", default, skip_serializing_if = "Option::is_none")] + pub kek_identity: Option, + #[serde(rename = "infrastructureEncryption", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_encryption: Option, + } + pub mod encryption { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InfrastructureEncryption { + Enabled, + Disabled, + } + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct MoveDetails { + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[serde(rename = "completionTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub completion_time_utc: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MoveState { + Unknown, + InProgress, + PrepareFailed, + CommitFailed, + PrepareTimedout, + CommitTimedout, + MoveSucceeded, + Failure, + CriticalFailure, + PartialSuccess, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupStorageVersion { + V1, + V2, + Unassigned, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultUsage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] + pub next_reset_time: Option, + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +pub mod vault_usage { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultUsageList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/recoveryservices/src/package_preview_2021_11/operations.rs b/services/mgmt/recoveryservices/src/package_preview_2021_11/operations.rs new file mode 100644 index 0000000000..8ffe04ee6d --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_preview_2021_11/operations.rs @@ -0,0 +1,1903 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn recovery_services(&self) -> recovery_services::Client { + recovery_services::Client(self.clone()) + } + pub fn registered_identities(&self) -> registered_identities::Client { + registered_identities::Client(self.clone()) + } + pub fn replication_usages(&self) -> replication_usages::Client { + replication_usages::Client(self.clone()) + } + pub fn usages(&self) -> usages::Client { + usages::Client(self.clone()) + } + pub fn vault_certificates(&self) -> vault_certificates::Client { + vault_certificates::Client(self.clone()) + } + pub fn vault_extended_info(&self) -> vault_extended_info::Client { + vault_extended_info::Client(self.clone()) + } + pub fn vaults(&self) -> vaults::Client { + vaults::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + VaultCertificates_Create(#[from] vault_certificates::create::Error), + #[error(transparent)] + RegisteredIdentities_Delete(#[from] registered_identities::delete::Error), + #[error(transparent)] + ReplicationUsages_List(#[from] replication_usages::list::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + PrivateLinkResources_Get(#[from] private_link_resources::get::Error), + #[error(transparent)] + RecoveryServices_CheckNameAvailability(#[from] recovery_services::check_name_availability::Error), + #[error(transparent)] + Vaults_ListBySubscriptionId(#[from] vaults::list_by_subscription_id::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Vaults_ListByResourceGroup(#[from] vaults::list_by_resource_group::Error), + #[error(transparent)] + Vaults_Get(#[from] vaults::get::Error), + #[error(transparent)] + Vaults_CreateOrUpdate(#[from] vaults::create_or_update::Error), + #[error(transparent)] + Vaults_Update(#[from] vaults::update::Error), + #[error(transparent)] + Vaults_Delete(#[from] vaults::delete::Error), + #[error(transparent)] + VaultExtendedInfo_Get(#[from] vault_extended_info::get::Error), + #[error(transparent)] + VaultExtendedInfo_CreateOrUpdate(#[from] vault_extended_info::create_or_update::Error), + #[error(transparent)] + VaultExtendedInfo_Update(#[from] vault_extended_info::update::Error), + #[error(transparent)] + GetOperationStatus(#[from] get_operation_status::Error), + #[error(transparent)] + GetOperationResult(#[from] get_operation_result::Error), + #[error(transparent)] + Usages_ListByVaults(#[from] usages::list_by_vaults::Error), +} +pub mod vault_certificates { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + certificate_name: impl Into, + certificate_request: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + certificate_name: certificate_name.into(), + certificate_request: certificate_request.into(), + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) certificate_name: String, + pub(crate) certificate_request: models::CertificateRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.certificate_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.certificate_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultCertificateResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod registered_identities { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + identity_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + identity_name: identity_name.into(), + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) identity_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/registeredIdentities/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.identity_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_usages { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationUsages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns the list of private link resources that need to be created for Backup and SiteRecovery"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + #[doc = "Returns a specified private link resource that need to be created for Backup and SiteRecovery"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + private_link_resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + private_link_resource_name: private_link_resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResources = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) private_link_resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.private_link_resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_services { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "API to check for resource name availability.\r\nA name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type\r\nor if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago"] + pub fn check_name_availability( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + location: impl Into, + input: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + location: location.into(), + input: input.into(), + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) location: String, + pub(crate) input: models::CheckNameAvailabilityParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vaults { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription_id(&self, subscription_id: impl Into) -> list_by_subscription_id::Builder { + list_by_subscription_id::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + vault: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + vault: vault.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + vault: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + vault: vault.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list_by_subscription_id { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/vaults", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Created201(models::Vault), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) vault: models::Vault, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vault).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) vault: models::PatchVault, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vault).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientDiscoveryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vault_extended_info { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + resource_resource_extended_info_details: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + resource_resource_extended_info_details: resource_resource_extended_info_details.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + resource_resource_extended_info_details: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + resource_resource_extended_info_details: resource_resource_extended_info_details.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) resource_resource_extended_info_details: models::VaultExtendedInfoResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_resource_extended_info_details).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) resource_resource_extended_info_details: models::VaultExtendedInfoResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_resource_extended_info_details).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn get_operation_status( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get_operation_status::Builder { + get_operation_status::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + pub fn get_operation_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } +} +pub mod get_operation_status { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod get_operation_result { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod usages { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_vaults( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list_by_vaults::Builder { + list_by_vaults::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list_by_vaults { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/recoveryservicesbackup/Cargo.toml b/services/mgmt/recoveryservicesbackup/Cargo.toml index 5cdf3c102b..8ea68fdc31 100644 --- a/services/mgmt/recoveryservicesbackup/Cargo.toml +++ b/services/mgmt/recoveryservicesbackup/Cargo.toml @@ -19,10 +19,13 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2021-08", "enable_reqwest"] +default = ["package-passivestamp-2021-11-15", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-passivestamp-2021-11-15" = [] +"package-passivestamp-2018-12-20" = [] +"package-2021-10" = [] "package-2021-08" = [] "package-2021-07" = [] "package-2021-06" = [] diff --git a/services/mgmt/recoveryservicesbackup/src/lib.rs b/services/mgmt/recoveryservicesbackup/src/lib.rs index f724cc4964..a5d6951e45 100644 --- a/services/mgmt/recoveryservicesbackup/src/lib.rs +++ b/services/mgmt/recoveryservicesbackup/src/lib.rs @@ -3,6 +3,18 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-passivestamp-2021-11-15")] +pub mod package_passivestamp_2021_11_15; +#[cfg(all(feature = "package-passivestamp-2021-11-15", not(feature = "no-default-version")))] +pub use package_passivestamp_2021_11_15::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-passivestamp-2018-12-20")] +pub mod package_passivestamp_2018_12_20; +#[cfg(all(feature = "package-passivestamp-2018-12-20", not(feature = "no-default-version")))] +pub use package_passivestamp_2018_12_20::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-10")] +pub mod package_2021_10; +#[cfg(all(feature = "package-2021-10", not(feature = "no-default-version")))] +pub use package_2021_10::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-08")] pub mod package_2021_08; #[cfg(all(feature = "package-2021-08", not(feature = "no-default-version")))] diff --git a/services/mgmt/recoveryservicesbackup/src/package_2017_07/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2017_07/models.rs index 2bdcd4a05d..3ff212cab7 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2017_07/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2017_07/models.rs @@ -8,73 +8,6 @@ pub struct AzureBackupGoalFeatureSupportRequest { pub feature_support_request: FeatureSupportRequest, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupServerContainer { - #[serde(flatten)] - pub dpm_container: DpmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupServerEngine { - #[serde(flatten)] - pub backup_engine_base: BackupEngineBase, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "parentContainerFabricId", default, skip_serializing_if = "Option::is_none")] - pub parent_container_fabric_id: Option, - #[serde(rename = "parentContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub parent_container_friendly_name: Option, - #[serde(rename = "azureFileShareType", default, skip_serializing_if = "Option::is_none")] - pub azure_file_share_type: Option, -} -pub mod azure_file_share_protectable_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum AzureFileShareType { - Invalid, - #[serde(rename = "XSMB")] - Xsmb, - XSync, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProvisionIlrRequest { - #[serde(flatten)] - pub ilr_request: IlrRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmContainer { - #[serde(flatten)] - pub iaa_svm_container: IaaSvmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmProtectableItem { - #[serde(flatten)] - pub iaa_svm_protectable_item: IaaSvmProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmContainer { - #[serde(flatten)] - pub iaa_svm_container: IaaSvmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmProtectableItem { - #[serde(flatten)] - pub iaa_svm_protectable_item: IaaSvmProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureIaaSvmErrorInfo { #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] pub error_code: Option, @@ -147,29 +80,6 @@ pub struct AzureResourceProtectionIntent { pub friendly_name: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlagWorkloadContainerProtectionContainer { - #[serde(flatten)] - pub azure_workload_container: AzureWorkloadContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] - pub storage_account_version: Option, - #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] - pub resource_group: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureStorageErrorInfo { #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] pub error_code: Option, @@ -212,21 +122,6 @@ pub struct AzureStorageJobTaskDetails { pub status: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageProtectableContainer { - #[serde(flatten)] - pub protectable_container: ProtectableContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmAppContainerProtectableContainer { - #[serde(flatten)] - pub protectable_container: ProtectableContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmAppContainerProtectionContainer { - #[serde(flatten)] - pub azure_workload_container: AzureWorkloadContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmResourceFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -254,188 +149,11 @@ pub mod azure_vm_resource_feature_support_response { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadItem { - #[serde(flatten)] - pub workload_item: WorkloadItem, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protectable: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subinquireditemcount: Option, - #[serde(rename = "subWorkloadItemCount", default, skip_serializing_if = "Option::is_none")] - pub sub_workload_item_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "parentUniqueName", default, skip_serializing_if = "Option::is_none")] - pub parent_unique_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protectable: Option, - #[serde(rename = "isAutoProtected", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protected: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subinquireditemcount: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subprotectableitemcount: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub prebackupvalidation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseSystemProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseSystemWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaSystemProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaSystemWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlAvailabilityGroupProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlInstanceProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlInstanceWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, - #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] - pub data_directory_paths: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadAutoProtectionIntent { #[serde(flatten)] pub azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "backupType", default, skip_serializing_if = "Option::is_none")] - pub backup_type: Option, - #[serde(rename = "enableCompression", default, skip_serializing_if = "Option::is_none")] - pub enable_compression: Option, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -pub mod azure_workload_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupType { - Invalid, - Full, - Differential, - Log, - CopyOnlyFull, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] - pub last_updated_time: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] - pub operation_type: Option, -} -pub mod azure_workload_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum OperationType { - Invalid, - Register, - Reregister, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadContainerExtendedInfo { - #[serde(rename = "hostServerName", default, skip_serializing_if = "Option::is_none")] - pub host_server_name: Option, - #[serde(rename = "inquiryInfo", default, skip_serializing_if = "Option::is_none")] - pub inquiry_info: Option, - #[serde(rename = "nodesList", default, skip_serializing_if = "Vec::is_empty")] - pub nodes_list: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadErrorInfo { #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] pub error_code: Option, @@ -506,38 +224,6 @@ pub mod azure_workload_sql_auto_protection_intent { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupEngineQueryObject { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupEnginesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, -} -pub mod bms_backup_engines_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupSummariesQueryObject { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, @@ -552,446 +238,50 @@ pub mod bms_backup_summaries_query_object { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsContainerQueryObject { - #[serde(rename = "backupManagementType")] - pub backup_management_type: bms_container_query_object::BackupManagementType, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_name: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, +pub struct BackupManagementUsage { #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, + pub unit: Option, + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] + pub next_reset_time: Option, + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, } -pub mod bms_container_query_object { +pub mod backup_management_usage { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, + pub enum Unit { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsContainersInquiryQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, +pub struct BackupManagementUsageList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupStatusRequest { + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] + pub po_logical_name: Option, } -pub mod bms_containers_inquiry_query_object { +pub mod backup_status_request { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmspoQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -pub mod bmspo_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureSql, - AzureBackupServer, - AzureWorkload, - AzureStorage, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsRefreshContainersQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bms_refresh_containers_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsWorkloadItemQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, -} -pub mod bms_workload_item_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureSql, - AzureBackupServer, - AzureWorkload, - AzureStorage, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBase { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, - #[serde(rename = "backupEngineState", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_state: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "backupEngineType", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_type: Option, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "backupEngineId", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_id: Option, - #[serde(rename = "dpmVersion", default, skip_serializing_if = "Option::is_none")] - pub dpm_version: Option, - #[serde(rename = "azureBackupAgentVersion", default, skip_serializing_if = "Option::is_none")] - pub azure_backup_agent_version: Option, - #[serde(rename = "isAzureBackupAgentUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub is_azure_backup_agent_upgrade_available: Option, - #[serde(rename = "isDpmUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub is_dpm_upgrade_available: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod backup_engine_base { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupEngineType { - Invalid, - DpmBackupEngine, - AzureBackupServerEngine, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBaseResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBaseResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineExtendedInfo { - #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] - pub database_name: Option, - #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] - pub protected_items_count: Option, - #[serde(rename = "protectedServersCount", default, skip_serializing_if = "Option::is_none")] - pub protected_servers_count: Option, - #[serde(rename = "diskCount", default, skip_serializing_if = "Option::is_none")] - pub disk_count: Option, - #[serde(rename = "usedDiskSpace", default, skip_serializing_if = "Option::is_none")] - pub used_disk_space: Option, - #[serde(rename = "availableDiskSpace", default, skip_serializing_if = "Option::is_none")] - pub available_disk_space: Option, - #[serde(rename = "refreshedAt", default, skip_serializing_if = "Option::is_none")] - pub refreshed_at: Option, - #[serde(rename = "azureProtectedInstances", default, skip_serializing_if = "Option::is_none")] - pub azure_protected_instances: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub unit: Option, - #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] - pub quota_period: Option, - #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] - pub next_reset_time: Option, - #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] - pub current_value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub limit: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, -} -pub mod backup_management_usage { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Unit { - Count, - Bytes, - Seconds, - Percent, - CountPerSecond, - BytesPerSecond, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsageList { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] - pub po_logical_name: Option, -} -pub mod backup_status_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { + pub enum ResourceType { Invalid, #[serde(rename = "VM")] Vm, @@ -1053,118 +343,6 @@ pub mod backup_status_response { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryDisplay { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub provider: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForLogSpecification { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] - pub blob_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForProperties { - #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] - pub service_specification: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForServiceSpecification { - #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] - pub log_specifications: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryValueForSingleApi { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub display: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub origin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientScriptForConnect { - #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] - pub script_content: Option, - #[serde(rename = "scriptExtension", default, skip_serializing_if = "Option::is_none")] - pub script_extension: Option, - #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] - pub os_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(rename = "scriptNameSuffix", default, skip_serializing_if = "Option::is_none")] - pub script_name_suffix: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ContainerIdentityInfo { - #[serde(rename = "uniqueName", default, skip_serializing_if = "Option::is_none")] - pub unique_name: Option, - #[serde(rename = "aadTenantId", default, skip_serializing_if = "Option::is_none")] - pub aad_tenant_id: Option, - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmContainerExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DistributedNodesInfo { - #[serde(rename = "nodeName", default, skip_serializing_if = "Option::is_none")] - pub node_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmBackupEngine { - #[serde(flatten)] - pub backup_engine_base: BackupEngineBase, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, - #[serde(rename = "dpmAgentVersion", default, skip_serializing_if = "Option::is_none")] - pub dpm_agent_version: Option, - #[serde(rename = "dpmServers", default, skip_serializing_if = "Vec::is_empty")] - pub dpm_servers: Vec, - #[serde(rename = "upgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub upgrade_available: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmErrorInfo { #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] pub error_string: Option, @@ -1215,111 +393,11 @@ pub struct DpmJobTaskDetails { pub status: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ErrorDetail { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct FeatureSupportRequest { #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] pub feature_type: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "extendedInformation", default, skip_serializing_if = "Option::is_none")] - pub extended_information: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericContainerExtendedInfo { - #[serde(rename = "rawCertData", default, skip_serializing_if = "Option::is_none")] - pub raw_cert_data: Option, - #[serde(rename = "containerIdentityInfo", default, skip_serializing_if = "Option::is_none")] - pub container_identity_info: Option, - #[serde(rename = "serviceEndpoints", default, skip_serializing_if = "Option::is_none")] - pub service_endpoints: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IlrRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IlrRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaaSvmContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_version: Option, - #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] - pub resource_group: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaaSvmProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmilrRegistrationRequest { - #[serde(flatten)] - pub ilr_request: IlrRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "initiatorName", default, skip_serializing_if = "Option::is_none")] - pub initiator_name: Option, - #[serde(rename = "renewExistingRegistration", default, skip_serializing_if = "Option::is_none")] - pub renew_existing_registration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InquiryInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, - #[serde(rename = "inquiryDetails", default, skip_serializing_if = "Vec::is_empty")] - pub inquiry_details: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InquiryValidation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, - #[serde(rename = "additionalDetail", default, skip_serializing_if = "Option::is_none")] - pub additional_detail: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InstantItemRecoveryTarget { - #[serde(rename = "clientScripts", default, skip_serializing_if = "Vec::is_empty")] - pub client_scripts: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InstantRpAdditionalDetails { #[serde(rename = "azureBackupRGNamePrefix", default, skip_serializing_if = "Option::is_none")] pub azure_backup_rg_name_prefix: Option, @@ -1349,98 +427,28 @@ pub mod job { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct JobResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainerHealthDetails { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub title: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, - #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] - pub agent_version: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "mabContainerHealthDetails", default, skip_serializing_if = "Vec::is_empty")] - pub mab_container_health_details: Vec, - #[serde(rename = "containerHealthState", default, skip_serializing_if = "Option::is_none")] - pub container_health_state: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainerExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, - #[serde(rename = "backupItemType", default, skip_serializing_if = "Option::is_none")] - pub backup_item_type: Option, - #[serde(rename = "backupItems", default, skip_serializing_if = "Vec::is_empty")] - pub backup_items: Vec, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, -} -pub mod mab_container_extended_info { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupItemType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MabErrorInfo { #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] pub error_string: Option, @@ -1547,87 +555,6 @@ pub struct NameInfo { pub localized_value: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatus { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -pub mod operation_status { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - InProgress, - Succeeded, - Failed, - Canceled, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusError { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusExtendedInfo { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusJobExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] - pub job_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusJobsExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "jobIds", default, skip_serializing_if = "Vec::is_empty")] - pub job_ids: Vec, - #[serde(rename = "failedJobsError", default, skip_serializing_if = "Option::is_none")] - pub failed_jobs_error: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusProvisionIlrExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "recoveryTarget", default, skip_serializing_if = "Option::is_none")] - pub recovery_target: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreBackupValidation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, -} -pub mod pre_backup_validation { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Success, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PreValidateEnableBackupRequest { #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] pub resource_type: Option, @@ -1690,144 +617,6 @@ pub mod pre_validate_enable_backup_response { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainer { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "protectableContainerType", default, skip_serializing_if = "Option::is_none")] - pub protectable_container_type: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, -} -pub mod protectable_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectableContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainerResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainerResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainer { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, -} -pub mod protection_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainerResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainerResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ProtectionIntent { #[serde(rename = "protectionIntentItemType", default, skip_serializing_if = "Option::is_none")] pub protection_intent_item_type: Option, @@ -1920,11 +709,6 @@ pub struct ProtectionIntentResourceList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RecoveryPoint { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Resource { #[serde(default, skip_serializing_if = "Option::is_none")] pub id: Option, @@ -1944,115 +728,3 @@ pub struct ResourceList { #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] pub next_link: Option, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SqlDataDirectory { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(rename = "logicalName", default, skip_serializing_if = "Option::is_none")] - pub logical_name: Option, -} -pub mod sql_data_directory { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { - Invalid, - Data, - Log, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TokenInformation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub token: Option, - #[serde(rename = "expiryTimeInUtcTicks", default, skip_serializing_if = "Option::is_none")] - pub expiry_time_in_utc_ticks: Option, - #[serde(rename = "securityPIN", default, skip_serializing_if = "Option::is_none")] - pub security_pin: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadInquiryDetails { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - #[serde(rename = "itemCount", default, skip_serializing_if = "Option::is_none")] - pub item_count: Option, - #[serde(rename = "inquiryValidation", default, skip_serializing_if = "Option::is_none")] - pub inquiry_validation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItem { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod workload_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItem { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "protectableItemType", default, skip_serializing_if = "Option::is_none")] - pub protectable_item_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod workload_protectable_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2017_07/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2017_07/operations.rs index 16ae6620b8..a957b2832b 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2017_07/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2017_07/operations.rs @@ -74,75 +74,21 @@ impl Client { pipeline, } } - pub fn backup_engines(&self) -> backup_engines::Client { - backup_engines::Client(self.clone()) - } - pub fn backup_operation_results(&self) -> backup_operation_results::Client { - backup_operation_results::Client(self.clone()) - } - pub fn backup_operation_statuses(&self) -> backup_operation_statuses::Client { - backup_operation_statuses::Client(self.clone()) - } - pub fn backup_protectable_items(&self) -> backup_protectable_items::Client { - backup_protectable_items::Client(self.clone()) - } - pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { - backup_protection_containers::Client(self.clone()) - } pub fn backup_protection_intent(&self) -> backup_protection_intent::Client { backup_protection_intent::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_status(&self) -> backup_status::Client { backup_status::Client(self.clone()) } pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_workload_items(&self) -> backup_workload_items::Client { - backup_workload_items::Client(self.clone()) - } - pub fn backups(&self) -> backups::Client { - backups::Client(self.clone()) - } pub fn feature_support(&self) -> feature_support::Client { feature_support::Client(self.clone()) } - pub fn item_level_recovery_connections(&self) -> item_level_recovery_connections::Client { - item_level_recovery_connections::Client(self.clone()) - } - pub fn operations(&self) -> operations::Client { - operations::Client(self.clone()) - } - pub fn protectable_containers(&self) -> protectable_containers::Client { - protectable_containers::Client(self.clone()) - } - pub fn protected_item_operation_statuses(&self) -> protected_item_operation_statuses::Client { - protected_item_operation_statuses::Client(self.clone()) - } - pub fn protection_container_operation_results(&self) -> protection_container_operation_results::Client { - protection_container_operation_results::Client(self.clone()) - } - pub fn protection_container_refresh_operation_results(&self) -> protection_container_refresh_operation_results::Client { - protection_container_refresh_operation_results::Client(self.clone()) - } - pub fn protection_containers(&self) -> protection_containers::Client { - protection_containers::Client(self.clone()) - } pub fn protection_intent(&self) -> protection_intent::Client { protection_intent::Client(self.clone()) } - pub fn protection_policies(&self) -> protection_policies::Client { - protection_policies::Client(self.clone()) - } - pub fn protection_policy_operation_statuses(&self) -> protection_policy_operation_statuses::Client { - protection_policy_operation_statuses::Client(self.clone()) - } - pub fn security_pi_ns(&self) -> security_pi_ns::Client { - security_pi_ns::Client(self.clone()) - } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -164,58 +110,6 @@ pub enum Error { BackupProtectionIntent_List(#[from] backup_protection_intent::list::Error), #[error(transparent)] BackupUsageSummaries_List(#[from] backup_usage_summaries::list::Error), - #[error(transparent)] - BackupEngines_List(#[from] backup_engines::list::Error), - #[error(transparent)] - BackupEngines_Get(#[from] backup_engines::get::Error), - #[error(transparent)] - ProtectionContainerRefreshOperationResults_Get(#[from] protection_container_refresh_operation_results::get::Error), - #[error(transparent)] - ProtectableContainers_List(#[from] protectable_containers::list::Error), - #[error(transparent)] - ProtectionContainers_Get(#[from] protection_containers::get::Error), - #[error(transparent)] - ProtectionContainers_Register(#[from] protection_containers::register::Error), - #[error(transparent)] - ProtectionContainers_Unregister(#[from] protection_containers::unregister::Error), - #[error(transparent)] - ProtectionContainers_Inquire(#[from] protection_containers::inquire::Error), - #[error(transparent)] - BackupWorkloadItems_List(#[from] backup_workload_items::list::Error), - #[error(transparent)] - ProtectionContainerOperationResults_Get(#[from] protection_container_operation_results::get::Error), - #[error(transparent)] - Backups_Trigger(#[from] backups::trigger::Error), - #[error(transparent)] - ProtectedItemOperationStatuses_Get(#[from] protected_item_operation_statuses::get::Error), - #[error(transparent)] - ItemLevelRecoveryConnections_Provision(#[from] item_level_recovery_connections::provision::Error), - #[error(transparent)] - ItemLevelRecoveryConnections_Revoke(#[from] item_level_recovery_connections::revoke::Error), - #[error(transparent)] - ProtectionContainers_Refresh(#[from] protection_containers::refresh::Error), - #[error(transparent)] - BackupOperationResults_Get(#[from] backup_operation_results::get::Error), - #[error(transparent)] - BackupOperationStatuses_Get(#[from] backup_operation_statuses::get::Error), - #[error(transparent)] - ProtectionPolicies_Delete(#[from] protection_policies::delete::Error), - #[error(transparent)] - ProtectionPolicyOperationStatuses_Get(#[from] protection_policy_operation_statuses::get::Error), - #[error(transparent)] - BackupProtectableItems_List(#[from] backup_protectable_items::list::Error), - #[error(transparent)] - BackupProtectionContainers_List(#[from] backup_protection_containers::list::Error), - #[error(transparent)] - SecurityPiNs_Get(#[from] security_pi_ns::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - Operations_List(#[from] operations::list::Error), } pub mod protection_intent { use super::{models, API_VERSION}; @@ -972,2455 +866,3 @@ pub mod backup_usage_summaries { } } } -pub mod backup_engines { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - backup_engine_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - backup_engine_name: backup_engine_name.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupEngineBaseResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) backup_engine_name: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.backup_engine_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupEngineBaseResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_container_refresh_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protectable_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectableContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectableContainerResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - } - } - pub fn register( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - parameters: impl Into, - ) -> register::Builder { - register::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - parameters: parameters.into(), - } - } - pub fn unregister( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> unregister::Builder { - unregister::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - } - } - #[doc = "Inquires all the protectable items under the given container."] - pub fn inquire( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> inquire::Builder { - inquire::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - filter: None, - } - } - pub fn refresh( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - ) -> refresh::Builder { - refresh::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod register { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionContainerResource), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) parameters: models::ProtectionContainerResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod unregister { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod inquire { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/inquire" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod refresh { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/refreshContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_workload_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/items" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::WorkloadItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_container_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionContainerResource), - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backups { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn trigger( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) parameters: models::BackupRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protected_item_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationsStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod item_level_recovery_connections { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn provision( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> provision::Builder { - provision::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } - pub fn revoke( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - ) -> revoke::Builder { - revoke::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - } - } - } - pub mod provision { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::IlrRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/provisionInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod revoke { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/revokeInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperations/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_policies { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - } - } - } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.policy_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_policy_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protectable_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectableItems", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::WorkloadProtectableItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionContainers", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod security_pi_ns { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupSecurityPIN", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TokenInformation = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod operations { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ClientDiscoveryResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2019_05/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2019_05/models.rs index e677e5d12f..5728d82201 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2019_05/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2019_05/models.rs @@ -3,49 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupGoalFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupServerContainer { - #[serde(flatten)] - pub dpm_container: DpmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupServerEngine { - #[serde(flatten)] - pub backup_engine_base: BackupEngineBase, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "parentContainerFabricId", default, skip_serializing_if = "Option::is_none")] - pub parent_container_fabric_id: Option, - #[serde(rename = "parentContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub parent_container_friendly_name: Option, - #[serde(rename = "azureFileShareType", default, skip_serializing_if = "Option::is_none")] - pub azure_file_share_type: Option, -} -pub mod azure_file_share_protectable_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum AzureFileShareType { - Invalid, - #[serde(rename = "XSMB")] - Xsmb, - XSync, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureFileShareProtectionPolicy { #[serde(flatten)] pub protection_policy: ProtectionPolicy, @@ -86,15 +43,6 @@ pub mod azure_file_share_protection_policy { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProvisionIlrRequest { - #[serde(flatten)] - pub ilr_request: IlrRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureFileShareRecoveryPoint { #[serde(flatten)] pub recovery_point: RecoveryPoint, @@ -202,31 +150,11 @@ pub struct AzureFileshareProtectedItemExtendedInfo { pub resource_state_sync_time: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmContainer { - #[serde(flatten)] - pub iaa_svm_container: IaaSvmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmProtectableItem { - #[serde(flatten)] - pub iaa_svm_protectable_item: IaaSvmProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureIaaSClassicComputeVmProtectedItem { #[serde(flatten)] pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmContainer { - #[serde(flatten)] - pub iaa_svm_container: IaaSvmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmProtectableItem { - #[serde(flatten)] - pub iaa_svm_protectable_item: IaaSvmProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureIaaSComputeVmProtectedItem { #[serde(flatten)] pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, @@ -372,28 +300,6 @@ pub struct AzureIaaSvmProtectionPolicy { pub time_zone: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureRecoveryServiceVaultProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureResourceProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlagWorkloadContainerProtectionContainer { - #[serde(flatten)] - pub azure_workload_container: AzureWorkloadContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureSqlProtectedItem { #[serde(flatten)] pub protected_item: ProtectedItem, @@ -434,19 +340,6 @@ pub struct AzureSqlProtectionPolicy { pub retention_policy: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] - pub storage_account_version: Option, - #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] - pub resource_group: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureStorageErrorInfo { #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] pub error_code: Option, @@ -489,84 +382,6 @@ pub struct AzureStorageJobTaskDetails { pub status: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageProtectableContainer { - #[serde(flatten)] - pub protectable_container: ProtectableContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmAppContainerProtectableContainer { - #[serde(flatten)] - pub protectable_container: ProtectableContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmAppContainerProtectionContainer { - #[serde(flatten)] - pub azure_workload_container: AzureWorkloadContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, - #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] - pub vm_size: Option, - #[serde(rename = "vmSku", default, skip_serializing_if = "Option::is_none")] - pub vm_sku: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportResponse { - #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] - pub support_status: Option, -} -pub mod azure_vm_resource_feature_support_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum SupportStatus { - Invalid, - Supported, - #[serde(rename = "DefaultOFF")] - DefaultOff, - #[serde(rename = "DefaultON")] - DefaultOn, - NotSupported, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadItem { - #[serde(flatten)] - pub workload_item: WorkloadItem, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protectable: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subinquireditemcount: Option, - #[serde(rename = "subWorkloadItemCount", default, skip_serializing_if = "Option::is_none")] - pub sub_workload_item_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "parentUniqueName", default, skip_serializing_if = "Option::is_none")] - pub parent_unique_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protectable: Option, - #[serde(rename = "isAutoProtected", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protected: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subinquireditemcount: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subprotectableitemcount: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub prebackupvalidation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmWorkloadProtectedItem { #[serde(flatten)] pub protected_item: ProtectedItem, @@ -680,162 +495,16 @@ pub struct AzureVmWorkloadSapAseDatabaseProtectedItem { pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseSystemProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseSystemWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmWorkloadSapHanaDatabaseProtectedItem { #[serde(flatten)] pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaSystemProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaSystemWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlAvailabilityGroupProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmWorkloadSqlDatabaseProtectedItem { #[serde(flatten)] pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlInstanceProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlInstanceWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, - #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] - pub data_directory_paths: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadAutoProtectionIntent { - #[serde(flatten)] - pub azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "backupType", default, skip_serializing_if = "Option::is_none")] - pub backup_type: Option, - #[serde(rename = "enableCompression", default, skip_serializing_if = "Option::is_none")] - pub enable_compression: Option, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -pub mod azure_workload_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupType { - Invalid, - Full, - Differential, - Log, - CopyOnlyFull, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] - pub last_updated_time: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] - pub operation_type: Option, -} -pub mod azure_workload_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum OperationType { - Invalid, - Register, - Reregister, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadContainerExtendedInfo { - #[serde(rename = "hostServerName", default, skip_serializing_if = "Option::is_none")] - pub host_server_name: Option, - #[serde(rename = "inquiryInfo", default, skip_serializing_if = "Option::is_none")] - pub inquiry_info: Option, - #[serde(rename = "nodesList", default, skip_serializing_if = "Vec::is_empty")] - pub nodes_list: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadErrorInfo { #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] pub error_code: Option, @@ -967,32 +636,6 @@ pub struct AzureWorkloadSapHanaRestoreRequest { pub azure_workload_restore_request: AzureWorkloadRestoreRequest, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlAutoProtectionIntent { - #[serde(flatten)] - pub azure_workload_auto_protection_intent: AzureWorkloadAutoProtectionIntent, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, -} -pub mod azure_workload_sql_auto_protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { #[serde(flatten)] pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, @@ -1041,522 +684,48 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupEngineQueryObject { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupEnginesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, +pub struct BmsrpQueryObject { + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] + pub restore_point_query_type: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, } -pub mod bms_backup_engines_query_object { +pub mod bmsrp_query_object { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { + pub enum RestorePointQueryType { Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, + Full, + Log, + Differential, + FullAndDifferential, + All, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupSummariesQueryObject { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, +pub struct BackupResourceVaultConfig { + #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] + pub storage_model_type: Option, + #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] + pub storage_type: Option, + #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] + pub storage_type_state: Option, + #[serde(rename = "enhancedSecurityState", default, skip_serializing_if = "Option::is_none")] + pub enhanced_security_state: Option, + #[serde(rename = "softDeleteFeatureState", default, skip_serializing_if = "Option::is_none")] + pub soft_delete_feature_state: Option, } -pub mod bms_backup_summaries_query_object { +pub mod backup_resource_vault_config { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { + pub enum StorageModelType { Invalid, - BackupProtectedItemCountSummary, - BackupProtectionContainerCountSummary, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsContainerQueryObject { - #[serde(rename = "backupManagementType")] - pub backup_management_type: bms_container_query_object::BackupManagementType, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_name: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -pub mod bms_container_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsContainersInquiryQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, -} -pub mod bms_containers_inquiry_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmspoQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -pub mod bmspo_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureSql, - AzureBackupServer, - AzureWorkload, - AzureStorage, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsrpQueryObject { - #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] - pub start_date: Option, - #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] - pub end_date: Option, - #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] - pub restore_point_query_type: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod bmsrp_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RestorePointQueryType { - Invalid, - Full, - Log, - Differential, - FullAndDifferential, - All, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsRefreshContainersQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bms_refresh_containers_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsWorkloadItemQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, -} -pub mod bms_workload_item_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureSql, - AzureBackupServer, - AzureWorkload, - AzureStorage, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBase { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, - #[serde(rename = "backupEngineState", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_state: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "backupEngineType", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_type: Option, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "backupEngineId", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_id: Option, - #[serde(rename = "dpmVersion", default, skip_serializing_if = "Option::is_none")] - pub dpm_version: Option, - #[serde(rename = "azureBackupAgentVersion", default, skip_serializing_if = "Option::is_none")] - pub azure_backup_agent_version: Option, - #[serde(rename = "isAzureBackupAgentUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub is_azure_backup_agent_upgrade_available: Option, - #[serde(rename = "isDpmUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub is_dpm_upgrade_available: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod backup_engine_base { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupEngineType { - Invalid, - DpmBackupEngine, - AzureBackupServerEngine, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBaseResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBaseResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineExtendedInfo { - #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] - pub database_name: Option, - #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] - pub protected_items_count: Option, - #[serde(rename = "protectedServersCount", default, skip_serializing_if = "Option::is_none")] - pub protected_servers_count: Option, - #[serde(rename = "diskCount", default, skip_serializing_if = "Option::is_none")] - pub disk_count: Option, - #[serde(rename = "usedDiskSpace", default, skip_serializing_if = "Option::is_none")] - pub used_disk_space: Option, - #[serde(rename = "availableDiskSpace", default, skip_serializing_if = "Option::is_none")] - pub available_disk_space: Option, - #[serde(rename = "refreshedAt", default, skip_serializing_if = "Option::is_none")] - pub refreshed_at: Option, - #[serde(rename = "azureProtectedInstances", default, skip_serializing_if = "Option::is_none")] - pub azure_protected_instances: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub unit: Option, - #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] - pub quota_period: Option, - #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] - pub next_reset_time: Option, - #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] - pub current_value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub limit: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, -} -pub mod backup_management_usage { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Unit { - Count, - Bytes, - Seconds, - Percent, - CountPerSecond, - BytesPerSecond, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsageList { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceVaultConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "enhancedSecurityState", default, skip_serializing_if = "Option::is_none")] - pub enhanced_security_state: Option, - #[serde(rename = "softDeleteFeatureState", default, skip_serializing_if = "Option::is_none")] - pub soft_delete_feature_state: Option, -} -pub mod backup_resource_vault_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, + GeoRedundant, + LocallyRedundant, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum StorageType { @@ -1591,156 +760,6 @@ pub struct BackupResourceVaultConfigResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] - pub po_logical_name: Option, -} -pub mod backup_status_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusResponse { - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, -} -pub mod backup_status_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum FabricName { - Invalid, - Azure, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryDisplay { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub provider: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForLogSpecification { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] - pub blob_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForProperties { - #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] - pub service_specification: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForServiceSpecification { - #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] - pub log_specifications: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryValueForSingleApi { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub display: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub origin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientScriptForConnect { - #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] - pub script_content: Option, - #[serde(rename = "scriptExtension", default, skip_serializing_if = "Option::is_none")] - pub script_extension: Option, - #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] - pub os_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(rename = "scriptNameSuffix", default, skip_serializing_if = "Option::is_none")] - pub script_name_suffix: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ContainerIdentityInfo { - #[serde(rename = "uniqueName", default, skip_serializing_if = "Option::is_none")] - pub unique_name: Option, - #[serde(rename = "aadTenantId", default, skip_serializing_if = "Option::is_none")] - pub aad_tenant_id: Option, - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmContainerExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmProtectedItem { #[serde(flatten)] pub protected_item: ProtectedItem, @@ -1831,41 +850,6 @@ pub struct DiskInformation { pub name: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DistributedNodesInfo { - #[serde(rename = "nodeName", default, skip_serializing_if = "Option::is_none")] - pub node_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmBackupEngine { - #[serde(flatten)] - pub backup_engine_base: BackupEngineBase, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, - #[serde(rename = "dpmAgentVersion", default, skip_serializing_if = "Option::is_none")] - pub dpm_agent_version: Option, - #[serde(rename = "dpmServers", default, skip_serializing_if = "Vec::is_empty")] - pub dpm_servers: Vec, - #[serde(rename = "upgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub upgrade_available: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmErrorInfo { #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] pub error_string: Option, @@ -1956,29 +940,6 @@ pub struct ExtendedProperties { pub disk_exclusion_properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct FeatureSupportRequest { - #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] - pub feature_type: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "extendedInformation", default, skip_serializing_if = "Option::is_none")] - pub extended_information: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericContainerExtendedInfo { - #[serde(rename = "rawCertData", default, skip_serializing_if = "Option::is_none")] - pub raw_cert_data: Option, - #[serde(rename = "containerIdentityInfo", default, skip_serializing_if = "Option::is_none")] - pub container_identity_info: Option, - #[serde(rename = "serviceEndpoints", default, skip_serializing_if = "Option::is_none")] - pub service_endpoints: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct GenericProtectedItem { #[serde(flatten)] pub protected_item: ProtectedItem, @@ -2038,56 +999,6 @@ pub struct GetProtectedItemQueryObject { pub expand: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IlrRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IlrRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaaSvmContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_version: Option, - #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] - pub resource_group: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaaSvmProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmilrRegistrationRequest { - #[serde(flatten)] - pub ilr_request: IlrRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "initiatorName", default, skip_serializing_if = "Option::is_none")] - pub initiator_name: Option, - #[serde(rename = "renewExistingRegistration", default, skip_serializing_if = "Option::is_none")] - pub renew_existing_registration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct IaasVmRecoveryPoint { #[serde(flatten)] pub recovery_point: RecoveryPoint, @@ -2165,36 +1076,6 @@ pub mod iaas_vm_restore_request { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InquiryInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, - #[serde(rename = "inquiryDetails", default, skip_serializing_if = "Vec::is_empty")] - pub inquiry_details: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InquiryValidation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, - #[serde(rename = "additionalDetail", default, skip_serializing_if = "Option::is_none")] - pub additional_detail: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InstantItemRecoveryTarget { - #[serde(rename = "clientScripts", default, skip_serializing_if = "Vec::is_empty")] - pub client_scripts: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InstantRpAdditionalDetails { - #[serde(rename = "azureBackupRGNamePrefix", default, skip_serializing_if = "Option::is_none")] - pub azure_backup_rg_name_prefix: Option, - #[serde(rename = "azureBackupRGNameSuffix", default, skip_serializing_if = "Option::is_none")] - pub azure_backup_rg_name_suffix: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Job { #[serde(rename = "entityFriendlyName", default, skip_serializing_if = "Option::is_none")] pub entity_friendly_name: Option, @@ -2336,83 +1217,13 @@ pub struct LongTermRetentionPolicy { pub weekly_schedule: Option, #[serde(rename = "monthlySchedule", default, skip_serializing_if = "Option::is_none")] pub monthly_schedule: Option, - #[serde(rename = "yearlySchedule", default, skip_serializing_if = "Option::is_none")] - pub yearly_schedule: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LongTermSchedulePolicy { - #[serde(flatten)] - pub schedule_policy: SchedulePolicy, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainerHealthDetails { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub title: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, - #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] - pub agent_version: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "mabContainerHealthDetails", default, skip_serializing_if = "Vec::is_empty")] - pub mab_container_health_details: Vec, - #[serde(rename = "containerHealthState", default, skip_serializing_if = "Option::is_none")] - pub container_health_state: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainerExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, - #[serde(rename = "backupItemType", default, skip_serializing_if = "Option::is_none")] - pub backup_item_type: Option, - #[serde(rename = "backupItems", default, skip_serializing_if = "Vec::is_empty")] - pub backup_items: Vec, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, + #[serde(rename = "yearlySchedule", default, skip_serializing_if = "Option::is_none")] + pub yearly_schedule: Option, } -pub mod mab_container_extended_info { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupItemType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LongTermSchedulePolicy { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MabErrorInfo { @@ -2573,13 +1384,6 @@ pub mod monthly_retention_schedule { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct NameInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] - pub localized_value: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationResultInfo { #[serde(flatten)] pub operation_result_info_base: OperationResultInfoBase, @@ -2588,295 +1392,83 @@ pub struct OperationResultInfo { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationResultInfoBase { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationResultInfoBaseResource { - #[serde(flatten)] - pub operation_worker_response: OperationWorkerResponse, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatus { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -pub mod operation_status { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - InProgress, - Succeeded, - Failed, - Canceled, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusError { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusExtendedInfo { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusJobExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] - pub job_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusJobsExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "jobIds", default, skip_serializing_if = "Vec::is_empty")] - pub job_ids: Vec, - #[serde(rename = "failedJobsError", default, skip_serializing_if = "Option::is_none")] - pub failed_jobs_error: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusProvisionIlrExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "recoveryTarget", default, skip_serializing_if = "Option::is_none")] - pub recovery_target: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationWorkerResponse { - #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] - pub status_code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub headers: Option, -} -pub mod operation_worker_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StatusCode { - Continue, - SwitchingProtocols, - #[serde(rename = "OK")] - Ok, - Created, - Accepted, - NonAuthoritativeInformation, - NoContent, - ResetContent, - PartialContent, - MultipleChoices, - Ambiguous, - MovedPermanently, - Moved, - Found, - Redirect, - SeeOther, - RedirectMethod, - NotModified, - UseProxy, - Unused, - TemporaryRedirect, - RedirectKeepVerb, - BadRequest, - Unauthorized, - PaymentRequired, - Forbidden, - NotFound, - MethodNotAllowed, - NotAcceptable, - ProxyAuthenticationRequired, - RequestTimeout, - Conflict, - Gone, - LengthRequired, - PreconditionFailed, - RequestEntityTooLarge, - RequestUriTooLong, - UnsupportedMediaType, - RequestedRangeNotSatisfiable, - ExpectationFailed, - UpgradeRequired, - InternalServerError, - NotImplemented, - BadGateway, - ServiceUnavailable, - GatewayTimeout, - HttpVersionNotSupported, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PointInTimeRange { - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreBackupValidation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, -} -pub mod pre_backup_validation { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Success, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -pub mod pre_validate_enable_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub recommendation: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, -} -pub mod pre_validate_enable_backup_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Succeeded, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainer { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "protectableContainerType", default, skip_serializing_if = "Option::is_none")] - pub protectable_container_type: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, -} -pub mod protectable_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectableContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } + #[serde(rename = "objectType")] + pub object_type: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainerResource { +pub struct OperationResultInfoBaseResource { #[serde(flatten)] - pub resource: Resource, + pub operation_worker_response: OperationWorkerResponse, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub operation: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainerResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, +pub struct OperationWorkerResponse { + #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] + pub status_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, +} +pub mod operation_worker_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StatusCode { + Continue, + SwitchingProtocols, + #[serde(rename = "OK")] + Ok, + Created, + Accepted, + NonAuthoritativeInformation, + NoContent, + ResetContent, + PartialContent, + MultipleChoices, + Ambiguous, + MovedPermanently, + Moved, + Found, + Redirect, + SeeOther, + RedirectMethod, + NotModified, + UseProxy, + Unused, + TemporaryRedirect, + RedirectKeepVerb, + BadRequest, + Unauthorized, + PaymentRequired, + Forbidden, + NotFound, + MethodNotAllowed, + NotAcceptable, + ProxyAuthenticationRequired, + RequestTimeout, + Conflict, + Gone, + LengthRequired, + PreconditionFailed, + RequestEntityTooLarge, + RequestUriTooLong, + UnsupportedMediaType, + RequestedRangeNotSatisfiable, + ExpectationFailed, + UpgradeRequired, + InternalServerError, + NotImplemented, + BadGateway, + ServiceUnavailable, + GatewayTimeout, + HttpVersionNotSupported, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PointInTimeRange { + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ProtectedItem { @@ -3042,167 +1634,6 @@ pub struct ProtectedItemResourceList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainer { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, -} -pub mod protection_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainerResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainerResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntent { - #[serde(rename = "protectionIntentItemType", default, skip_serializing_if = "Option::is_none")] - pub protection_intent_item_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "itemId", default, skip_serializing_if = "Option::is_none")] - pub item_id: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] - pub item_type: Option, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "itemName", default, skip_serializing_if = "Option::is_none")] - pub item_name: Option, -} -pub mod protection_intent_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLAvailabilityGroupContainer")] - SqlAvailabilityGroupContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ProtectionPolicy { #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] pub protected_items_count: Option, @@ -3520,15 +1951,6 @@ pub mod target_restore_info { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TokenInformation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub token: Option, - #[serde(rename = "expiryTimeInUtcTicks", default, skip_serializing_if = "Option::is_none")] - pub expiry_time_in_utc_ticks: Option, - #[serde(rename = "securityPIN", default, skip_serializing_if = "Option::is_none")] - pub security_pin: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ValidateIaasVmRestoreOperationRequest { #[serde(flatten)] pub validate_restore_operation_request: ValidateRestoreOperationRequest, @@ -3572,91 +1994,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadInquiryDetails { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - #[serde(rename = "itemCount", default, skip_serializing_if = "Option::is_none")] - pub item_count: Option, - #[serde(rename = "inquiryValidation", default, skip_serializing_if = "Option::is_none")] - pub inquiry_validation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItem { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod workload_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItem { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "protectableItemType", default, skip_serializing_if = "Option::is_none")] - pub protectable_item_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod workload_protectable_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct YearlyRetentionSchedule { #[serde(rename = "retentionScheduleFormatType", default, skip_serializing_if = "Option::is_none")] pub retention_schedule_format_type: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2019_05/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2019_05/operations.rs index 9695e27b72..99fb79e247 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2019_05/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2019_05/operations.rs @@ -74,60 +74,21 @@ impl Client { pipeline, } } - pub fn backup_engines(&self) -> backup_engines::Client { - backup_engines::Client(self.clone()) - } pub fn backup_jobs(&self) -> backup_jobs::Client { backup_jobs::Client(self.clone()) } - pub fn backup_operation_results(&self) -> backup_operation_results::Client { - backup_operation_results::Client(self.clone()) - } - pub fn backup_operation_statuses(&self) -> backup_operation_statuses::Client { - backup_operation_statuses::Client(self.clone()) - } pub fn backup_policies(&self) -> backup_policies::Client { backup_policies::Client(self.clone()) } - pub fn backup_protectable_items(&self) -> backup_protectable_items::Client { - backup_protectable_items::Client(self.clone()) - } pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { - backup_protection_containers::Client(self.clone()) - } - pub fn backup_protection_intent(&self) -> backup_protection_intent::Client { - backup_protection_intent::Client(self.clone()) - } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } - pub fn backup_status(&self) -> backup_status::Client { - backup_status::Client(self.clone()) - } - pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { - backup_usage_summaries::Client(self.clone()) - } - pub fn backup_workload_items(&self) -> backup_workload_items::Client { - backup_workload_items::Client(self.clone()) - } - pub fn backups(&self) -> backups::Client { - backups::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } - pub fn feature_support(&self) -> feature_support::Client { - feature_support::Client(self.clone()) - } - pub fn item_level_recovery_connections(&self) -> item_level_recovery_connections::Client { - item_level_recovery_connections::Client(self.clone()) - } pub fn job_cancellations(&self) -> job_cancellations::Client { job_cancellations::Client(self.clone()) } @@ -143,51 +104,24 @@ impl Client { pub fn operation(&self) -> operation::Client { operation::Client(self.clone()) } - pub fn operations(&self) -> operations::Client { - operations::Client(self.clone()) - } - pub fn protectable_containers(&self) -> protectable_containers::Client { - protectable_containers::Client(self.clone()) - } pub fn protected_item_operation_results(&self) -> protected_item_operation_results::Client { protected_item_operation_results::Client(self.clone()) } - pub fn protected_item_operation_statuses(&self) -> protected_item_operation_statuses::Client { - protected_item_operation_statuses::Client(self.clone()) - } pub fn protected_items(&self) -> protected_items::Client { protected_items::Client(self.clone()) } - pub fn protection_container_operation_results(&self) -> protection_container_operation_results::Client { - protection_container_operation_results::Client(self.clone()) - } - pub fn protection_container_refresh_operation_results(&self) -> protection_container_refresh_operation_results::Client { - protection_container_refresh_operation_results::Client(self.clone()) - } - pub fn protection_containers(&self) -> protection_containers::Client { - protection_containers::Client(self.clone()) - } - pub fn protection_intent(&self) -> protection_intent::Client { - protection_intent::Client(self.clone()) - } pub fn protection_policies(&self) -> protection_policies::Client { protection_policies::Client(self.clone()) } pub fn protection_policy_operation_results(&self) -> protection_policy_operation_results::Client { protection_policy_operation_results::Client(self.clone()) } - pub fn protection_policy_operation_statuses(&self) -> protection_policy_operation_statuses::Client { - protection_policy_operation_statuses::Client(self.clone()) - } pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } pub fn restores(&self) -> restores::Client { restores::Client(self.clone()) } - pub fn security_pi_ns(&self) -> security_pi_ns::Client { - security_pi_ns::Client(self.clone()) - } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -235,74 +169,6 @@ pub enum Error { BackupProtectedItems_List(#[from] backup_protected_items::list::Error), #[error(transparent)] Operation_Validate(#[from] operation::validate::Error), - #[error(transparent)] - ProtectionIntent_Validate(#[from] protection_intent::validate::Error), - #[error(transparent)] - BackupStatus_Get(#[from] backup_status::get::Error), - #[error(transparent)] - FeatureSupport_Validate(#[from] feature_support::validate::Error), - #[error(transparent)] - ProtectionIntent_Get(#[from] protection_intent::get::Error), - #[error(transparent)] - ProtectionIntent_CreateOrUpdate(#[from] protection_intent::create_or_update::Error), - #[error(transparent)] - ProtectionIntent_Delete(#[from] protection_intent::delete::Error), - #[error(transparent)] - BackupProtectionIntent_List(#[from] backup_protection_intent::list::Error), - #[error(transparent)] - BackupUsageSummaries_List(#[from] backup_usage_summaries::list::Error), - #[error(transparent)] - BackupEngines_List(#[from] backup_engines::list::Error), - #[error(transparent)] - BackupEngines_Get(#[from] backup_engines::get::Error), - #[error(transparent)] - ProtectionContainerRefreshOperationResults_Get(#[from] protection_container_refresh_operation_results::get::Error), - #[error(transparent)] - ProtectableContainers_List(#[from] protectable_containers::list::Error), - #[error(transparent)] - ProtectionContainers_Get(#[from] protection_containers::get::Error), - #[error(transparent)] - ProtectionContainers_Register(#[from] protection_containers::register::Error), - #[error(transparent)] - ProtectionContainers_Unregister(#[from] protection_containers::unregister::Error), - #[error(transparent)] - ProtectionContainers_Inquire(#[from] protection_containers::inquire::Error), - #[error(transparent)] - BackupWorkloadItems_List(#[from] backup_workload_items::list::Error), - #[error(transparent)] - ProtectionContainerOperationResults_Get(#[from] protection_container_operation_results::get::Error), - #[error(transparent)] - Backups_Trigger(#[from] backups::trigger::Error), - #[error(transparent)] - ProtectedItemOperationStatuses_Get(#[from] protected_item_operation_statuses::get::Error), - #[error(transparent)] - ItemLevelRecoveryConnections_Provision(#[from] item_level_recovery_connections::provision::Error), - #[error(transparent)] - ItemLevelRecoveryConnections_Revoke(#[from] item_level_recovery_connections::revoke::Error), - #[error(transparent)] - ProtectionContainers_Refresh(#[from] protection_containers::refresh::Error), - #[error(transparent)] - BackupOperationResults_Get(#[from] backup_operation_results::get::Error), - #[error(transparent)] - BackupOperationStatuses_Get(#[from] backup_operation_statuses::get::Error), - #[error(transparent)] - ProtectionPolicies_Delete(#[from] protection_policies::delete::Error), - #[error(transparent)] - ProtectionPolicyOperationStatuses_Get(#[from] protection_policy_operation_statuses::get::Error), - #[error(transparent)] - BackupProtectableItems_List(#[from] backup_protectable_items::list::Error), - #[error(transparent)] - BackupProtectionContainers_List(#[from] backup_protection_containers::list::Error), - #[error(transparent)] - SecurityPiNs_Get(#[from] security_pi_ns::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - Operations_List(#[from] operations::list::Error), } pub mod backup_resource_vault_configs { use super::{models, API_VERSION}; @@ -1311,21 +1177,6 @@ pub mod protection_policies { parameters: parameters.into(), } } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - } - } } pub mod get { use super::{models, API_VERSION}; @@ -1483,81 +1334,6 @@ pub mod protection_policies { } } } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.policy_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } } pub mod protection_policy_operation_results { use super::{models, API_VERSION}; @@ -2440,3114 +2216,3 @@ pub mod operation { } } } -pub mod protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate followings\r\n1. Vault capacity\r\n2. VM is already protected\r\n3. Any VM related configuration passed in properties."] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - pub fn create_or_update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - parameters: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - parameters: parameters.into(), - } - } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::PreValidateEnableBackupRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupPreValidateProtection", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PreValidateEnableBackupResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod create_or_update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - pub(crate) parameters: models::ProtectionIntentResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get the container backup status"] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupStatusRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupStatus", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupStatusResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod feature_support { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate if given feature with resource properties is supported in service"] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::FeatureSupportRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> - { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupValidateFeatures", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AzureVmResourceFeatureSupportResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionIntents", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_usage_summaries { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_engines { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - backup_engine_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - backup_engine_name: backup_engine_name.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupEngineBaseResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) backup_engine_name: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.backup_engine_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupEngineBaseResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_container_refresh_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protectable_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectableContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectableContainerResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - } - } - pub fn register( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - parameters: impl Into, - ) -> register::Builder { - register::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - parameters: parameters.into(), - } - } - pub fn unregister( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> unregister::Builder { - unregister::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - } - } - #[doc = "Inquires all the protectable items under the given container."] - pub fn inquire( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> inquire::Builder { - inquire::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - filter: None, - } - } - pub fn refresh( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - ) -> refresh::Builder { - refresh::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod register { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionContainerResource), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) parameters: models::ProtectionContainerResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod unregister { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod inquire { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/inquire" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod refresh { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/refreshContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_workload_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/items" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::WorkloadItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_container_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionContainerResource), - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backups { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn trigger( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) parameters: models::BackupRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protected_item_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationsStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod item_level_recovery_connections { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn provision( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> provision::Builder { - provision::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } - pub fn revoke( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - ) -> revoke::Builder { - revoke::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - } - } - } - pub mod provision { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::IlrRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/provisionInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod revoke { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/revokeInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperations/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_policy_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protectable_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectableItems", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::WorkloadProtectableItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionContainers", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod security_pi_ns { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupSecurityPIN", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TokenInformation = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod operations { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ClientDiscoveryResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2019_06/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2019_06/models.rs index 10d09386f7..60c1975ce0 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2019_06/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2019_06/models.rs @@ -3,49 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupGoalFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupServerContainer { - #[serde(flatten)] - pub dpm_container: DpmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupServerEngine { - #[serde(flatten)] - pub backup_engine_base: BackupEngineBase, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "parentContainerFabricId", default, skip_serializing_if = "Option::is_none")] - pub parent_container_fabric_id: Option, - #[serde(rename = "parentContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub parent_container_friendly_name: Option, - #[serde(rename = "azureFileShareType", default, skip_serializing_if = "Option::is_none")] - pub azure_file_share_type: Option, -} -pub mod azure_file_share_protectable_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum AzureFileShareType { - Invalid, - #[serde(rename = "XSMB")] - Xsmb, - XSync, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureFileShareProtectionPolicy { #[serde(flatten)] pub protection_policy: ProtectionPolicy, @@ -86,15 +43,6 @@ pub mod azure_file_share_protection_policy { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProvisionIlrRequest { - #[serde(flatten)] - pub ilr_request: IlrRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureFileShareRecoveryPoint { #[serde(flatten)] pub recovery_point: RecoveryPoint, @@ -195,31 +143,11 @@ pub struct AzureFileshareProtectedItemExtendedInfo { pub resource_state_sync_time: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmContainer { - #[serde(flatten)] - pub iaa_svm_container: IaaSvmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmProtectableItem { - #[serde(flatten)] - pub iaa_svm_protectable_item: IaaSvmProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureIaaSClassicComputeVmProtectedItem { #[serde(flatten)] pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmContainer { - #[serde(flatten)] - pub iaa_svm_container: IaaSvmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmProtectableItem { - #[serde(flatten)] - pub iaa_svm_protectable_item: IaaSvmProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureIaaSComputeVmProtectedItem { #[serde(flatten)] pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, @@ -363,28 +291,6 @@ pub struct AzureIaaSvmProtectionPolicy { pub time_zone: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureRecoveryServiceVaultProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureResourceProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlagWorkloadContainerProtectionContainer { - #[serde(flatten)] - pub azure_workload_container: AzureWorkloadContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureSqlProtectedItem { #[serde(flatten)] pub protected_item: ProtectedItem, @@ -425,19 +331,6 @@ pub struct AzureSqlProtectionPolicy { pub retention_policy: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] - pub storage_account_version: Option, - #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] - pub resource_group: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureStorageErrorInfo { #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] pub error_code: Option, @@ -480,84 +373,6 @@ pub struct AzureStorageJobTaskDetails { pub status: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageProtectableContainer { - #[serde(flatten)] - pub protectable_container: ProtectableContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmAppContainerProtectableContainer { - #[serde(flatten)] - pub protectable_container: ProtectableContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmAppContainerProtectionContainer { - #[serde(flatten)] - pub azure_workload_container: AzureWorkloadContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, - #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] - pub vm_size: Option, - #[serde(rename = "vmSku", default, skip_serializing_if = "Option::is_none")] - pub vm_sku: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportResponse { - #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] - pub support_status: Option, -} -pub mod azure_vm_resource_feature_support_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum SupportStatus { - Invalid, - Supported, - #[serde(rename = "DefaultOFF")] - DefaultOff, - #[serde(rename = "DefaultON")] - DefaultOn, - NotSupported, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadItem { - #[serde(flatten)] - pub workload_item: WorkloadItem, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protectable: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subinquireditemcount: Option, - #[serde(rename = "subWorkloadItemCount", default, skip_serializing_if = "Option::is_none")] - pub sub_workload_item_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "parentUniqueName", default, skip_serializing_if = "Option::is_none")] - pub parent_unique_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protectable: Option, - #[serde(rename = "isAutoProtected", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protected: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subinquireditemcount: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subprotectableitemcount: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub prebackupvalidation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmWorkloadProtectedItem { #[serde(flatten)] pub protected_item: ProtectedItem, @@ -673,162 +488,16 @@ pub struct AzureVmWorkloadSapAseDatabaseProtectedItem { pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseSystemProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseSystemWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmWorkloadSapHanaDatabaseProtectedItem { #[serde(flatten)] pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaSystemProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaSystemWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlAvailabilityGroupProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmWorkloadSqlDatabaseProtectedItem { #[serde(flatten)] pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlInstanceProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlInstanceWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, - #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] - pub data_directory_paths: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadAutoProtectionIntent { - #[serde(flatten)] - pub azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "backupType", default, skip_serializing_if = "Option::is_none")] - pub backup_type: Option, - #[serde(rename = "enableCompression", default, skip_serializing_if = "Option::is_none")] - pub enable_compression: Option, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -pub mod azure_workload_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupType { - Invalid, - Full, - Differential, - Log, - CopyOnlyFull, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] - pub last_updated_time: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] - pub operation_type: Option, -} -pub mod azure_workload_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum OperationType { - Invalid, - Register, - Reregister, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadContainerExtendedInfo { - #[serde(rename = "hostServerName", default, skip_serializing_if = "Option::is_none")] - pub host_server_name: Option, - #[serde(rename = "inquiryInfo", default, skip_serializing_if = "Option::is_none")] - pub inquiry_info: Option, - #[serde(rename = "nodesList", default, skip_serializing_if = "Vec::is_empty")] - pub nodes_list: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadErrorInfo { #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] pub error_code: Option, @@ -960,32 +629,6 @@ pub struct AzureWorkloadSapHanaRestoreRequest { pub azure_workload_restore_request: AzureWorkloadRestoreRequest, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlAutoProtectionIntent { - #[serde(flatten)] - pub azure_workload_auto_protection_intent: AzureWorkloadAutoProtectionIntent, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, -} -pub mod azure_workload_sql_auto_protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { #[serde(flatten)] pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, @@ -1034,522 +677,48 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupEngineQueryObject { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupEnginesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, +pub struct BmsrpQueryObject { + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] + pub restore_point_query_type: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, } -pub mod bms_backup_engines_query_object { +pub mod bmsrp_query_object { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { + pub enum RestorePointQueryType { Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, + Full, + Log, + Differential, + FullAndDifferential, + All, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupSummariesQueryObject { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, +pub struct BackupResourceVaultConfig { + #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] + pub storage_model_type: Option, + #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] + pub storage_type: Option, + #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] + pub storage_type_state: Option, + #[serde(rename = "enhancedSecurityState", default, skip_serializing_if = "Option::is_none")] + pub enhanced_security_state: Option, + #[serde(rename = "softDeleteFeatureState", default, skip_serializing_if = "Option::is_none")] + pub soft_delete_feature_state: Option, } -pub mod bms_backup_summaries_query_object { +pub mod backup_resource_vault_config { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { + pub enum StorageModelType { Invalid, - BackupProtectedItemCountSummary, - BackupProtectionContainerCountSummary, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsContainerQueryObject { - #[serde(rename = "backupManagementType")] - pub backup_management_type: bms_container_query_object::BackupManagementType, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_name: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -pub mod bms_container_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsContainersInquiryQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, -} -pub mod bms_containers_inquiry_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmspoQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -pub mod bmspo_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureSql, - AzureBackupServer, - AzureWorkload, - AzureStorage, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsrpQueryObject { - #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] - pub start_date: Option, - #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] - pub end_date: Option, - #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] - pub restore_point_query_type: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod bmsrp_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RestorePointQueryType { - Invalid, - Full, - Log, - Differential, - FullAndDifferential, - All, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsRefreshContainersQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bms_refresh_containers_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsWorkloadItemQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, -} -pub mod bms_workload_item_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureSql, - AzureBackupServer, - AzureWorkload, - AzureStorage, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBase { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, - #[serde(rename = "backupEngineState", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_state: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "backupEngineType", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_type: Option, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "backupEngineId", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_id: Option, - #[serde(rename = "dpmVersion", default, skip_serializing_if = "Option::is_none")] - pub dpm_version: Option, - #[serde(rename = "azureBackupAgentVersion", default, skip_serializing_if = "Option::is_none")] - pub azure_backup_agent_version: Option, - #[serde(rename = "isAzureBackupAgentUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub is_azure_backup_agent_upgrade_available: Option, - #[serde(rename = "isDpmUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub is_dpm_upgrade_available: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod backup_engine_base { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupEngineType { - Invalid, - DpmBackupEngine, - AzureBackupServerEngine, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBaseResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBaseResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineExtendedInfo { - #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] - pub database_name: Option, - #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] - pub protected_items_count: Option, - #[serde(rename = "protectedServersCount", default, skip_serializing_if = "Option::is_none")] - pub protected_servers_count: Option, - #[serde(rename = "diskCount", default, skip_serializing_if = "Option::is_none")] - pub disk_count: Option, - #[serde(rename = "usedDiskSpace", default, skip_serializing_if = "Option::is_none")] - pub used_disk_space: Option, - #[serde(rename = "availableDiskSpace", default, skip_serializing_if = "Option::is_none")] - pub available_disk_space: Option, - #[serde(rename = "refreshedAt", default, skip_serializing_if = "Option::is_none")] - pub refreshed_at: Option, - #[serde(rename = "azureProtectedInstances", default, skip_serializing_if = "Option::is_none")] - pub azure_protected_instances: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub unit: Option, - #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] - pub quota_period: Option, - #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] - pub next_reset_time: Option, - #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] - pub current_value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub limit: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, -} -pub mod backup_management_usage { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Unit { - Count, - Bytes, - Seconds, - Percent, - CountPerSecond, - BytesPerSecond, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsageList { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceVaultConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "enhancedSecurityState", default, skip_serializing_if = "Option::is_none")] - pub enhanced_security_state: Option, - #[serde(rename = "softDeleteFeatureState", default, skip_serializing_if = "Option::is_none")] - pub soft_delete_feature_state: Option, -} -pub mod backup_resource_vault_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, + GeoRedundant, + LocallyRedundant, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum StorageType { @@ -1584,156 +753,6 @@ pub struct BackupResourceVaultConfigResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] - pub po_logical_name: Option, -} -pub mod backup_status_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusResponse { - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, -} -pub mod backup_status_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum FabricName { - Invalid, - Azure, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryDisplay { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub provider: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForLogSpecification { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] - pub blob_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForProperties { - #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] - pub service_specification: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForServiceSpecification { - #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] - pub log_specifications: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryValueForSingleApi { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub display: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub origin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientScriptForConnect { - #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] - pub script_content: Option, - #[serde(rename = "scriptExtension", default, skip_serializing_if = "Option::is_none")] - pub script_extension: Option, - #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] - pub os_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(rename = "scriptNameSuffix", default, skip_serializing_if = "Option::is_none")] - pub script_name_suffix: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ContainerIdentityInfo { - #[serde(rename = "uniqueName", default, skip_serializing_if = "Option::is_none")] - pub unique_name: Option, - #[serde(rename = "aadTenantId", default, skip_serializing_if = "Option::is_none")] - pub aad_tenant_id: Option, - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmContainerExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmProtectedItem { #[serde(flatten)] pub protected_item: ProtectedItem, @@ -1824,41 +843,6 @@ pub struct DiskInformation { pub name: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DistributedNodesInfo { - #[serde(rename = "nodeName", default, skip_serializing_if = "Option::is_none")] - pub node_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmBackupEngine { - #[serde(flatten)] - pub backup_engine_base: BackupEngineBase, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, - #[serde(rename = "dpmAgentVersion", default, skip_serializing_if = "Option::is_none")] - pub dpm_agent_version: Option, - #[serde(rename = "dpmServers", default, skip_serializing_if = "Vec::is_empty")] - pub dpm_servers: Vec, - #[serde(rename = "upgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub upgrade_available: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmErrorInfo { #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] pub error_string: Option, @@ -1969,29 +953,6 @@ pub struct ExtendedProperties { pub disk_exclusion_properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct FeatureSupportRequest { - #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] - pub feature_type: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "extendedInformation", default, skip_serializing_if = "Option::is_none")] - pub extended_information: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericContainerExtendedInfo { - #[serde(rename = "rawCertData", default, skip_serializing_if = "Option::is_none")] - pub raw_cert_data: Option, - #[serde(rename = "containerIdentityInfo", default, skip_serializing_if = "Option::is_none")] - pub container_identity_info: Option, - #[serde(rename = "serviceEndpoints", default, skip_serializing_if = "Option::is_none")] - pub service_endpoints: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct GenericProtectedItem { #[serde(flatten)] pub protected_item: ProtectedItem, @@ -2051,56 +1012,6 @@ pub struct GetProtectedItemQueryObject { pub expand: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IlrRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IlrRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaaSvmContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_version: Option, - #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] - pub resource_group: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaaSvmProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmilrRegistrationRequest { - #[serde(flatten)] - pub ilr_request: IlrRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "initiatorName", default, skip_serializing_if = "Option::is_none")] - pub initiator_name: Option, - #[serde(rename = "renewExistingRegistration", default, skip_serializing_if = "Option::is_none")] - pub renew_existing_registration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct IaasVmRecoveryPoint { #[serde(flatten)] pub recovery_point: RecoveryPoint, @@ -2178,29 +1089,6 @@ pub mod iaas_vm_restore_request { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InquiryInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, - #[serde(rename = "inquiryDetails", default, skip_serializing_if = "Vec::is_empty")] - pub inquiry_details: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InquiryValidation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, - #[serde(rename = "additionalDetail", default, skip_serializing_if = "Option::is_none")] - pub additional_detail: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InstantItemRecoveryTarget { - #[serde(rename = "clientScripts", default, skip_serializing_if = "Vec::is_empty")] - pub client_scripts: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InstantRpAdditionalDetails { #[serde(rename = "azureBackupRGNamePrefix", default, skip_serializing_if = "Option::is_none")] pub azure_backup_rg_name_prefix: Option, @@ -2368,83 +1256,13 @@ pub struct LongTermRetentionPolicy { pub weekly_schedule: Option, #[serde(rename = "monthlySchedule", default, skip_serializing_if = "Option::is_none")] pub monthly_schedule: Option, - #[serde(rename = "yearlySchedule", default, skip_serializing_if = "Option::is_none")] - pub yearly_schedule: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LongTermSchedulePolicy { - #[serde(flatten)] - pub schedule_policy: SchedulePolicy, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainerHealthDetails { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub title: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, - #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] - pub agent_version: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "mabContainerHealthDetails", default, skip_serializing_if = "Vec::is_empty")] - pub mab_container_health_details: Vec, - #[serde(rename = "containerHealthState", default, skip_serializing_if = "Option::is_none")] - pub container_health_state: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainerExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, - #[serde(rename = "backupItemType", default, skip_serializing_if = "Option::is_none")] - pub backup_item_type: Option, - #[serde(rename = "backupItems", default, skip_serializing_if = "Vec::is_empty")] - pub backup_items: Vec, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, + #[serde(rename = "yearlySchedule", default, skip_serializing_if = "Option::is_none")] + pub yearly_schedule: Option, } -pub mod mab_container_extended_info { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupItemType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LongTermSchedulePolicy { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MabErrorInfo { @@ -2605,13 +1423,6 @@ pub mod monthly_retention_schedule { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct NameInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] - pub localized_value: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationResultInfo { #[serde(flatten)] pub operation_result_info_base: OperationResultInfoBase, @@ -2620,295 +1431,83 @@ pub struct OperationResultInfo { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationResultInfoBase { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationResultInfoBaseResource { - #[serde(flatten)] - pub operation_worker_response: OperationWorkerResponse, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatus { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -pub mod operation_status { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - InProgress, - Succeeded, - Failed, - Canceled, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusError { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusExtendedInfo { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusJobExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] - pub job_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusJobsExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "jobIds", default, skip_serializing_if = "Vec::is_empty")] - pub job_ids: Vec, - #[serde(rename = "failedJobsError", default, skip_serializing_if = "Option::is_none")] - pub failed_jobs_error: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusProvisionIlrExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "recoveryTarget", default, skip_serializing_if = "Option::is_none")] - pub recovery_target: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationWorkerResponse { - #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] - pub status_code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub headers: Option, -} -pub mod operation_worker_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StatusCode { - Continue, - SwitchingProtocols, - #[serde(rename = "OK")] - Ok, - Created, - Accepted, - NonAuthoritativeInformation, - NoContent, - ResetContent, - PartialContent, - MultipleChoices, - Ambiguous, - MovedPermanently, - Moved, - Found, - Redirect, - SeeOther, - RedirectMethod, - NotModified, - UseProxy, - Unused, - TemporaryRedirect, - RedirectKeepVerb, - BadRequest, - Unauthorized, - PaymentRequired, - Forbidden, - NotFound, - MethodNotAllowed, - NotAcceptable, - ProxyAuthenticationRequired, - RequestTimeout, - Conflict, - Gone, - LengthRequired, - PreconditionFailed, - RequestEntityTooLarge, - RequestUriTooLong, - UnsupportedMediaType, - RequestedRangeNotSatisfiable, - ExpectationFailed, - UpgradeRequired, - InternalServerError, - NotImplemented, - BadGateway, - ServiceUnavailable, - GatewayTimeout, - HttpVersionNotSupported, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PointInTimeRange { - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreBackupValidation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, -} -pub mod pre_backup_validation { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Success, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -pub mod pre_validate_enable_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub recommendation: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, -} -pub mod pre_validate_enable_backup_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Succeeded, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainer { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "protectableContainerType", default, skip_serializing_if = "Option::is_none")] - pub protectable_container_type: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, -} -pub mod protectable_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectableContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } + #[serde(rename = "objectType")] + pub object_type: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainerResource { +pub struct OperationResultInfoBaseResource { #[serde(flatten)] - pub resource: Resource, + pub operation_worker_response: OperationWorkerResponse, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub operation: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainerResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, +pub struct OperationWorkerResponse { + #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] + pub status_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, +} +pub mod operation_worker_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StatusCode { + Continue, + SwitchingProtocols, + #[serde(rename = "OK")] + Ok, + Created, + Accepted, + NonAuthoritativeInformation, + NoContent, + ResetContent, + PartialContent, + MultipleChoices, + Ambiguous, + MovedPermanently, + Moved, + Found, + Redirect, + SeeOther, + RedirectMethod, + NotModified, + UseProxy, + Unused, + TemporaryRedirect, + RedirectKeepVerb, + BadRequest, + Unauthorized, + PaymentRequired, + Forbidden, + NotFound, + MethodNotAllowed, + NotAcceptable, + ProxyAuthenticationRequired, + RequestTimeout, + Conflict, + Gone, + LengthRequired, + PreconditionFailed, + RequestEntityTooLarge, + RequestUriTooLong, + UnsupportedMediaType, + RequestedRangeNotSatisfiable, + ExpectationFailed, + UpgradeRequired, + InternalServerError, + NotImplemented, + BadGateway, + ServiceUnavailable, + GatewayTimeout, + HttpVersionNotSupported, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PointInTimeRange { + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ProtectedItem { @@ -3074,167 +1673,6 @@ pub struct ProtectedItemResourceList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainer { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, -} -pub mod protection_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainerResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainerResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntent { - #[serde(rename = "protectionIntentItemType", default, skip_serializing_if = "Option::is_none")] - pub protection_intent_item_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "itemId", default, skip_serializing_if = "Option::is_none")] - pub item_id: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] - pub item_type: Option, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "itemName", default, skip_serializing_if = "Option::is_none")] - pub item_name: Option, -} -pub mod protection_intent_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLAvailabilityGroupContainer")] - SqlAvailabilityGroupContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ProtectionPolicy { #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] pub protected_items_count: Option, @@ -3565,15 +2003,6 @@ pub mod target_restore_info { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TokenInformation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub token: Option, - #[serde(rename = "expiryTimeInUtcTicks", default, skip_serializing_if = "Option::is_none")] - pub expiry_time_in_utc_ticks: Option, - #[serde(rename = "securityPIN", default, skip_serializing_if = "Option::is_none")] - pub security_pin: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ValidateIaasVmRestoreOperationRequest { #[serde(flatten)] pub validate_restore_operation_request: ValidateRestoreOperationRequest, @@ -3617,91 +2046,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadInquiryDetails { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - #[serde(rename = "itemCount", default, skip_serializing_if = "Option::is_none")] - pub item_count: Option, - #[serde(rename = "inquiryValidation", default, skip_serializing_if = "Option::is_none")] - pub inquiry_validation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItem { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod workload_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItem { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "protectableItemType", default, skip_serializing_if = "Option::is_none")] - pub protectable_item_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod workload_protectable_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct YearlyRetentionSchedule { #[serde(rename = "retentionScheduleFormatType", default, skip_serializing_if = "Option::is_none")] pub retention_schedule_format_type: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2019_06/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2019_06/operations.rs index 4011414672..38bf587116 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2019_06/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2019_06/operations.rs @@ -74,60 +74,21 @@ impl Client { pipeline, } } - pub fn backup_engines(&self) -> backup_engines::Client { - backup_engines::Client(self.clone()) - } pub fn backup_jobs(&self) -> backup_jobs::Client { backup_jobs::Client(self.clone()) } - pub fn backup_operation_results(&self) -> backup_operation_results::Client { - backup_operation_results::Client(self.clone()) - } - pub fn backup_operation_statuses(&self) -> backup_operation_statuses::Client { - backup_operation_statuses::Client(self.clone()) - } pub fn backup_policies(&self) -> backup_policies::Client { backup_policies::Client(self.clone()) } - pub fn backup_protectable_items(&self) -> backup_protectable_items::Client { - backup_protectable_items::Client(self.clone()) - } pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { - backup_protection_containers::Client(self.clone()) - } - pub fn backup_protection_intent(&self) -> backup_protection_intent::Client { - backup_protection_intent::Client(self.clone()) - } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } - pub fn backup_status(&self) -> backup_status::Client { - backup_status::Client(self.clone()) - } - pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { - backup_usage_summaries::Client(self.clone()) - } - pub fn backup_workload_items(&self) -> backup_workload_items::Client { - backup_workload_items::Client(self.clone()) - } - pub fn backups(&self) -> backups::Client { - backups::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } - pub fn feature_support(&self) -> feature_support::Client { - feature_support::Client(self.clone()) - } - pub fn item_level_recovery_connections(&self) -> item_level_recovery_connections::Client { - item_level_recovery_connections::Client(self.clone()) - } pub fn job_cancellations(&self) -> job_cancellations::Client { job_cancellations::Client(self.clone()) } @@ -143,51 +104,24 @@ impl Client { pub fn operation(&self) -> operation::Client { operation::Client(self.clone()) } - pub fn operations(&self) -> operations::Client { - operations::Client(self.clone()) - } - pub fn protectable_containers(&self) -> protectable_containers::Client { - protectable_containers::Client(self.clone()) - } pub fn protected_item_operation_results(&self) -> protected_item_operation_results::Client { protected_item_operation_results::Client(self.clone()) } - pub fn protected_item_operation_statuses(&self) -> protected_item_operation_statuses::Client { - protected_item_operation_statuses::Client(self.clone()) - } pub fn protected_items(&self) -> protected_items::Client { protected_items::Client(self.clone()) } - pub fn protection_container_operation_results(&self) -> protection_container_operation_results::Client { - protection_container_operation_results::Client(self.clone()) - } - pub fn protection_container_refresh_operation_results(&self) -> protection_container_refresh_operation_results::Client { - protection_container_refresh_operation_results::Client(self.clone()) - } - pub fn protection_containers(&self) -> protection_containers::Client { - protection_containers::Client(self.clone()) - } - pub fn protection_intent(&self) -> protection_intent::Client { - protection_intent::Client(self.clone()) - } pub fn protection_policies(&self) -> protection_policies::Client { protection_policies::Client(self.clone()) } pub fn protection_policy_operation_results(&self) -> protection_policy_operation_results::Client { protection_policy_operation_results::Client(self.clone()) } - pub fn protection_policy_operation_statuses(&self) -> protection_policy_operation_statuses::Client { - protection_policy_operation_statuses::Client(self.clone()) - } pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } pub fn restores(&self) -> restores::Client { restores::Client(self.clone()) } - pub fn security_pi_ns(&self) -> security_pi_ns::Client { - security_pi_ns::Client(self.clone()) - } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -237,74 +171,6 @@ pub enum Error { BackupProtectedItems_List(#[from] backup_protected_items::list::Error), #[error(transparent)] Operation_Validate(#[from] operation::validate::Error), - #[error(transparent)] - ProtectionIntent_Validate(#[from] protection_intent::validate::Error), - #[error(transparent)] - BackupStatus_Get(#[from] backup_status::get::Error), - #[error(transparent)] - FeatureSupport_Validate(#[from] feature_support::validate::Error), - #[error(transparent)] - ProtectionIntent_Get(#[from] protection_intent::get::Error), - #[error(transparent)] - ProtectionIntent_CreateOrUpdate(#[from] protection_intent::create_or_update::Error), - #[error(transparent)] - ProtectionIntent_Delete(#[from] protection_intent::delete::Error), - #[error(transparent)] - BackupProtectionIntent_List(#[from] backup_protection_intent::list::Error), - #[error(transparent)] - BackupUsageSummaries_List(#[from] backup_usage_summaries::list::Error), - #[error(transparent)] - BackupEngines_List(#[from] backup_engines::list::Error), - #[error(transparent)] - BackupEngines_Get(#[from] backup_engines::get::Error), - #[error(transparent)] - ProtectionContainerRefreshOperationResults_Get(#[from] protection_container_refresh_operation_results::get::Error), - #[error(transparent)] - ProtectableContainers_List(#[from] protectable_containers::list::Error), - #[error(transparent)] - ProtectionContainers_Get(#[from] protection_containers::get::Error), - #[error(transparent)] - ProtectionContainers_Register(#[from] protection_containers::register::Error), - #[error(transparent)] - ProtectionContainers_Unregister(#[from] protection_containers::unregister::Error), - #[error(transparent)] - ProtectionContainers_Inquire(#[from] protection_containers::inquire::Error), - #[error(transparent)] - BackupWorkloadItems_List(#[from] backup_workload_items::list::Error), - #[error(transparent)] - ProtectionContainerOperationResults_Get(#[from] protection_container_operation_results::get::Error), - #[error(transparent)] - Backups_Trigger(#[from] backups::trigger::Error), - #[error(transparent)] - ProtectedItemOperationStatuses_Get(#[from] protected_item_operation_statuses::get::Error), - #[error(transparent)] - ItemLevelRecoveryConnections_Provision(#[from] item_level_recovery_connections::provision::Error), - #[error(transparent)] - ItemLevelRecoveryConnections_Revoke(#[from] item_level_recovery_connections::revoke::Error), - #[error(transparent)] - ProtectionContainers_Refresh(#[from] protection_containers::refresh::Error), - #[error(transparent)] - BackupOperationResults_Get(#[from] backup_operation_results::get::Error), - #[error(transparent)] - BackupOperationStatuses_Get(#[from] backup_operation_statuses::get::Error), - #[error(transparent)] - ProtectionPolicies_Delete(#[from] protection_policies::delete::Error), - #[error(transparent)] - ProtectionPolicyOperationStatuses_Get(#[from] protection_policy_operation_statuses::get::Error), - #[error(transparent)] - BackupProtectableItems_List(#[from] backup_protectable_items::list::Error), - #[error(transparent)] - BackupProtectionContainers_List(#[from] backup_protection_containers::list::Error), - #[error(transparent)] - SecurityPiNs_Get(#[from] security_pi_ns::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - Operations_List(#[from] operations::list::Error), } pub mod backup_resource_vault_configs { use super::{models, API_VERSION}; @@ -1409,21 +1275,6 @@ pub mod protection_policies { parameters: parameters.into(), } } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - } - } } pub mod get { use super::{models, API_VERSION}; @@ -1581,81 +1432,6 @@ pub mod protection_policies { } } } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.policy_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } } pub mod protection_policy_operation_results { use super::{models, API_VERSION}; @@ -2538,3114 +2314,3 @@ pub mod operation { } } } -pub mod protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate followings\r\n1. Vault capacity\r\n2. VM is already protected\r\n3. Any VM related configuration passed in properties."] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - pub fn create_or_update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - parameters: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - parameters: parameters.into(), - } - } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::PreValidateEnableBackupRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupPreValidateProtection", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PreValidateEnableBackupResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod create_or_update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - pub(crate) parameters: models::ProtectionIntentResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get the container backup status"] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupStatusRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupStatus", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupStatusResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod feature_support { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate if given feature with resource properties is supported in service"] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::FeatureSupportRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> - { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupValidateFeatures", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AzureVmResourceFeatureSupportResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionIntents", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_usage_summaries { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_engines { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - backup_engine_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - backup_engine_name: backup_engine_name.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupEngineBaseResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) backup_engine_name: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.backup_engine_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupEngineBaseResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_container_refresh_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protectable_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectableContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectableContainerResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - } - } - pub fn register( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - parameters: impl Into, - ) -> register::Builder { - register::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - parameters: parameters.into(), - } - } - pub fn unregister( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> unregister::Builder { - unregister::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - } - } - #[doc = "Inquires all the protectable items under the given container."] - pub fn inquire( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> inquire::Builder { - inquire::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - filter: None, - } - } - pub fn refresh( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - ) -> refresh::Builder { - refresh::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod register { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionContainerResource), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) parameters: models::ProtectionContainerResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod unregister { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod inquire { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/inquire" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod refresh { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/refreshContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_workload_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/items" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::WorkloadItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_container_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionContainerResource), - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backups { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn trigger( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) parameters: models::BackupRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protected_item_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationsStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod item_level_recovery_connections { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn provision( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> provision::Builder { - provision::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } - pub fn revoke( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - ) -> revoke::Builder { - revoke::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - } - } - } - pub mod provision { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::IlrRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/provisionInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod revoke { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/revokeInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperations/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_policy_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protectable_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectableItems", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::WorkloadProtectableItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionContainers", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod security_pi_ns { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupSecurityPIN", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TokenInformation = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod operations { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ClientDiscoveryResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2020_02/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2020_02/models.rs index 2cd8c08885..e5205a0ba6 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2020_02/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2020_02/models.rs @@ -3,3410 +3,106 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupGoalFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupServerContainer { - #[serde(flatten)] - pub dpm_container: DpmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupServerEngine { - #[serde(flatten)] - pub backup_engine_base: BackupEngineBase, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "parentContainerFabricId", default, skip_serializing_if = "Option::is_none")] - pub parent_container_fabric_id: Option, - #[serde(rename = "parentContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub parent_container_friendly_name: Option, - #[serde(rename = "azureFileShareType", default, skip_serializing_if = "Option::is_none")] - pub azure_file_share_type: Option, -} -pub mod azure_file_share_protectable_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum AzureFileShareType { - Invalid, - #[serde(rename = "XSMB")] - Xsmb, - XSync, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProtectionPolicy { - #[serde(flatten)] - pub protection_policy: ProtectionPolicy, - #[serde(rename = "workLoadType", default, skip_serializing_if = "Option::is_none")] - pub work_load_type: Option, - #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] - pub schedule_policy: Option, - #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] - pub retention_policy: Option, - #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] - pub time_zone: Option, -} -pub mod azure_file_share_protection_policy { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkLoadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareProvisionIlrRequest { - #[serde(flatten)] - pub ilr_request: IlrRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareRecoveryPoint { - #[serde(flatten)] - pub recovery_point: RecoveryPoint, - #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_type: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "fileShareSnapshotUri", default, skip_serializing_if = "Option::is_none")] - pub file_share_snapshot_uri: Option, - #[serde(rename = "recoveryPointSizeInGB", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_size_in_gb: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileShareRestoreRequest { - #[serde(flatten)] - pub restore_request: RestoreRequest, - #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] - pub recovery_type: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "copyOptions", default, skip_serializing_if = "Option::is_none")] - pub copy_options: Option, - #[serde(rename = "restoreRequestType", default, skip_serializing_if = "Option::is_none")] - pub restore_request_type: Option, - #[serde(rename = "restoreFileSpecs", default, skip_serializing_if = "Vec::is_empty")] - pub restore_file_specs: Vec, - #[serde(rename = "targetDetails", default, skip_serializing_if = "Option::is_none")] - pub target_details: Option, -} -pub mod azure_file_share_restore_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RecoveryType { - Invalid, - OriginalLocation, - AlternateLocation, - RestoreDisks, - Offline, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum CopyOptions { - Invalid, - CreateCopy, - Skip, - Overwrite, - FailOnConflict, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RestoreRequestType { - Invalid, - FullShareRestore, - ItemLevelRestore, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileshareProtectedItem { - #[serde(flatten)] - pub protected_item: ProtectedItem, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, - #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] - pub last_backup_time: Option, - #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] - pub kpis_healths: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod azure_fileshare_protected_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - #[serde(rename = "IRPending")] - IrPending, - Protected, - ProtectionError, - ProtectionStopped, - ProtectionPaused, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileshareProtectedItemExtendedInfo { - #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub oldest_recovery_point: Option, - #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_count: Option, - #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] - pub policy_state: Option, - #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] - pub resource_state: Option, - #[serde(rename = "resourceStateSyncTime", default, skip_serializing_if = "Option::is_none")] - pub resource_state_sync_time: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmContainer { - #[serde(flatten)] - pub iaa_svm_container: IaaSvmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmProtectableItem { - #[serde(flatten)] - pub iaa_svm_protectable_item: IaaSvmProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSClassicComputeVmProtectedItem { - #[serde(flatten)] - pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmContainer { - #[serde(flatten)] - pub iaa_svm_container: IaaSvmContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmProtectableItem { - #[serde(flatten)] - pub iaa_svm_protectable_item: IaaSvmProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSComputeVmProtectedItem { - #[serde(flatten)] - pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSvmErrorInfo { - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] - pub error_title: Option, - #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] - pub error_string: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSvmHealthDetails { - #[serde(flatten)] - pub resource_health_details: ResourceHealthDetails, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSvmJob { - #[serde(flatten)] - pub job: Job, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration: Option, - #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] - pub actions_info: Vec, - #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] - pub error_details: Vec, - #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_version: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSvmJobExtendedInfo { - #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] - pub tasks_list: Vec, - #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] - pub property_bag: Option, - #[serde(rename = "internalPropertyBag", default, skip_serializing_if = "Option::is_none")] - pub internal_property_bag: Option, - #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] - pub progress_percentage: Option, - #[serde(rename = "estimatedRemainingDuration", default, skip_serializing_if = "Option::is_none")] - pub estimated_remaining_duration: Option, - #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] - pub dynamic_error_message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSvmJobTaskDetails { - #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] - pub task_id: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, - #[serde(rename = "instanceId", default, skip_serializing_if = "Option::is_none")] - pub instance_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] - pub progress_percentage: Option, - #[serde(rename = "taskExecutionDetails", default, skip_serializing_if = "Option::is_none")] - pub task_execution_details: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSvmProtectedItem { - #[serde(flatten)] - pub protected_item: ProtectedItem, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "healthDetails", default, skip_serializing_if = "Vec::is_empty")] - pub health_details: Vec, - #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] - pub kpis_healths: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, - #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] - pub last_backup_time: Option, - #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] - pub protected_item_data_id: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "extendedProperties", default, skip_serializing_if = "Option::is_none")] - pub extended_properties: Option, -} -pub mod azure_iaa_svm_protected_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - #[serde(rename = "IRPending")] - IrPending, - Protected, - ProtectionError, - ProtectionStopped, - ProtectionPaused, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum HealthStatus { - Passed, - ActionRequired, - ActionSuggested, - Invalid, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSvmProtectedItemExtendedInfo { - #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub oldest_recovery_point: Option, - #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_count: Option, - #[serde(rename = "policyInconsistent", default, skip_serializing_if = "Option::is_none")] - pub policy_inconsistent: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureIaaSvmProtectionPolicy { - #[serde(flatten)] - pub protection_policy: ProtectionPolicy, - #[serde(rename = "instantRPDetails", default, skip_serializing_if = "Option::is_none")] - pub instant_rp_details: Option, - #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] - pub schedule_policy: Option, - #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] - pub retention_policy: Option, - #[serde(rename = "instantRpRetentionRangeInDays", default, skip_serializing_if = "Option::is_none")] - pub instant_rp_retention_range_in_days: Option, - #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] - pub time_zone: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureRecoveryServiceVaultProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureResourceProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlagWorkloadContainerProtectionContainer { - #[serde(flatten)] - pub azure_workload_container: AzureWorkloadContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlProtectedItem { - #[serde(flatten)] - pub protected_item: ProtectedItem, - #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] - pub protected_item_data_id: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod azure_sql_protected_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - #[serde(rename = "IRPending")] - IrPending, - Protected, - ProtectionError, - ProtectionStopped, - ProtectionPaused, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlProtectedItemExtendedInfo { - #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub oldest_recovery_point: Option, - #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_count: Option, - #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] - pub policy_state: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlProtectionPolicy { - #[serde(flatten)] - pub protection_policy: ProtectionPolicy, - #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] - pub retention_policy: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] - pub storage_account_version: Option, - #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] - pub resource_group: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageErrorInfo { - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] - pub error_string: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageJob { - #[serde(flatten)] - pub job: Job, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration: Option, - #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] - pub actions_info: Vec, - #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] - pub error_details: Vec, - #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] - pub storage_account_name: Option, - #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] - pub storage_account_version: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageJobExtendedInfo { - #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] - pub tasks_list: Vec, - #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] - pub property_bag: Option, - #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] - pub dynamic_error_message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageJobTaskDetails { - #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] - pub task_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureStorageProtectableContainer { - #[serde(flatten)] - pub protectable_container: ProtectableContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmAppContainerProtectableContainer { - #[serde(flatten)] - pub protectable_container: ProtectableContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmAppContainerProtectionContainer { - #[serde(flatten)] - pub azure_workload_container: AzureWorkloadContainer, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, - #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] - pub vm_size: Option, - #[serde(rename = "vmSku", default, skip_serializing_if = "Option::is_none")] - pub vm_sku: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportResponse { - #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] - pub support_status: Option, -} -pub mod azure_vm_resource_feature_support_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum SupportStatus { - Invalid, - Supported, - #[serde(rename = "DefaultOFF")] - DefaultOff, - #[serde(rename = "DefaultON")] - DefaultOn, - NotSupported, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadItem { - #[serde(flatten)] - pub workload_item: WorkloadItem, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protectable: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subinquireditemcount: Option, - #[serde(rename = "subWorkloadItemCount", default, skip_serializing_if = "Option::is_none")] - pub sub_workload_item_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "parentUniqueName", default, skip_serializing_if = "Option::is_none")] - pub parent_unique_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protectable: Option, - #[serde(rename = "isAutoProtected", default, skip_serializing_if = "Option::is_none")] - pub is_auto_protected: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subinquireditemcount: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subprotectableitemcount: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub prebackupvalidation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadProtectedItem { - #[serde(flatten)] - pub protected_item: ProtectedItem, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] - pub server_name: Option, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "parentType", default, skip_serializing_if = "Option::is_none")] - pub parent_type: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, - #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] - pub last_backup_time: Option, - #[serde(rename = "lastBackupErrorDetail", default, skip_serializing_if = "Option::is_none")] - pub last_backup_error_detail: Option, - #[serde(rename = "protectedItemDataSourceId", default, skip_serializing_if = "Option::is_none")] - pub protected_item_data_source_id: Option, - #[serde(rename = "protectedItemHealthStatus", default, skip_serializing_if = "Option::is_none")] - pub protected_item_health_status: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] - pub kpis_healths: Option, -} -pub mod azure_vm_workload_protected_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - #[serde(rename = "IRPending")] - IrPending, - Protected, - ProtectionError, - ProtectionStopped, - ProtectionPaused, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum LastBackupStatus { - Invalid, - Healthy, - Unhealthy, - #[serde(rename = "IRPending")] - IrPending, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectedItemHealthStatus { - Invalid, - Healthy, - Unhealthy, - NotReachable, - #[serde(rename = "IRPending")] - IrPending, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadProtectedItemExtendedInfo { - #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub oldest_recovery_point: Option, - #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_count: Option, - #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] - pub policy_state: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadProtectionPolicy { - #[serde(flatten)] - pub protection_policy: ProtectionPolicy, - #[serde(rename = "workLoadType", default, skip_serializing_if = "Option::is_none")] - pub work_load_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub settings: Option, - #[serde(rename = "subProtectionPolicy", default, skip_serializing_if = "Vec::is_empty")] - pub sub_protection_policy: Vec, - #[serde(rename = "makePolicyConsistent", default, skip_serializing_if = "Option::is_none")] - pub make_policy_consistent: Option, -} -pub mod azure_vm_workload_protection_policy { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkLoadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseDatabaseProtectedItem { - #[serde(flatten)] - pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseSystemProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapAseSystemWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseProtectedItem { - #[serde(flatten)] - pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaSystemProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSapHanaSystemWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlAvailabilityGroupProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseProtectedItem { - #[serde(flatten)] - pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlDatabaseWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlInstanceProtectableItem { - #[serde(flatten)] - pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmWorkloadSqlInstanceWorkloadItem { - #[serde(flatten)] - pub azure_vm_workload_item: AzureVmWorkloadItem, - #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] - pub data_directory_paths: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadAutoProtectionIntent { - #[serde(flatten)] - pub azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "backupType", default, skip_serializing_if = "Option::is_none")] - pub backup_type: Option, - #[serde(rename = "enableCompression", default, skip_serializing_if = "Option::is_none")] - pub enable_compression: Option, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -pub mod azure_workload_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupType { - Invalid, - Full, - Differential, - Log, - CopyOnlyFull, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] - pub last_updated_time: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] - pub operation_type: Option, -} -pub mod azure_workload_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum OperationType { - Invalid, - Register, - Reregister, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadContainerExtendedInfo { - #[serde(rename = "hostServerName", default, skip_serializing_if = "Option::is_none")] - pub host_server_name: Option, - #[serde(rename = "inquiryInfo", default, skip_serializing_if = "Option::is_none")] - pub inquiry_info: Option, - #[serde(rename = "nodesList", default, skip_serializing_if = "Vec::is_empty")] - pub nodes_list: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadErrorInfo { - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] - pub error_string: Option, - #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] - pub error_title: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, - #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] - pub additional_details: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadJob { - #[serde(flatten)] - pub job: Job, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration: Option, - #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] - pub actions_info: Vec, - #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] - pub error_details: Vec, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadJobExtendedInfo { - #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] - pub tasks_list: Vec, - #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] - pub property_bag: Option, - #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] - pub dynamic_error_message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadJobTaskDetails { - #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] - pub task_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadPointInTimeRecoveryPoint { - #[serde(flatten)] - pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, - #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] - pub time_ranges: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadPointInTimeRestoreRequest { - #[serde(flatten)] - pub azure_workload_restore_request: AzureWorkloadRestoreRequest, - #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] - pub point_in_time: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadRecoveryPoint { - #[serde(flatten)] - pub recovery_point: RecoveryPoint, - #[serde(rename = "recoveryPointTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time_in_utc: Option, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, -} -pub mod azure_workload_recovery_point { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { - Invalid, - Full, - Log, - Differential, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadRestoreRequest { - #[serde(flatten)] - pub restore_request: RestoreRequest, - #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] - pub recovery_type: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] - pub property_bag: Option, - #[serde(rename = "targetInfo", default, skip_serializing_if = "Option::is_none")] - pub target_info: Option, - #[serde(rename = "recoveryMode", default, skip_serializing_if = "Option::is_none")] - pub recovery_mode: Option, -} -pub mod azure_workload_restore_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RecoveryType { - Invalid, - OriginalLocation, - AlternateLocation, - RestoreDisks, - Offline, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RecoveryMode { - Invalid, - FileRecovery, - WorkloadRecovery, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSapHanaPointInTimeRecoveryPoint { - #[serde(flatten)] - pub azure_workload_point_in_time_recovery_point: AzureWorkloadPointInTimeRecoveryPoint, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSapHanaPointInTimeRestoreRequest { - #[serde(flatten)] - pub azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest, - #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] - pub point_in_time: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSapHanaRecoveryPoint { - #[serde(flatten)] - pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSapHanaRestoreRequest { - #[serde(flatten)] - pub azure_workload_restore_request: AzureWorkloadRestoreRequest, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlAutoProtectionIntent { - #[serde(flatten)] - pub azure_workload_auto_protection_intent: AzureWorkloadAutoProtectionIntent, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, -} -pub mod azure_workload_sql_auto_protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { - #[serde(flatten)] - pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, - #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] - pub time_ranges: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlPointInTimeRestoreRequest { - #[serde(flatten)] - pub azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest, - #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] - pub point_in_time: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlRecoveryPoint { - #[serde(flatten)] - pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlRecoveryPointExtendedInfo { - #[serde(rename = "dataDirectoryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub data_directory_time_in_utc: Option, - #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] - pub data_directory_paths: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlRestoreRequest { - #[serde(flatten)] - pub azure_workload_restore_request: AzureWorkloadRestoreRequest, - #[serde(rename = "shouldUseAlternateTargetLocation", default, skip_serializing_if = "Option::is_none")] - pub should_use_alternate_target_location: Option, - #[serde(rename = "isNonRecoverable", default, skip_serializing_if = "Option::is_none")] - pub is_non_recoverable: Option, - #[serde(rename = "alternateDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] - pub alternate_directory_paths: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BekDetails { - #[serde(rename = "secretUrl", default, skip_serializing_if = "Option::is_none")] - pub secret_url: Option, - #[serde(rename = "secretVaultId", default, skip_serializing_if = "Option::is_none")] - pub secret_vault_id: Option, - #[serde(rename = "secretData", default, skip_serializing_if = "Option::is_none")] - pub secret_data: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupEngineQueryObject { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupEnginesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, -} -pub mod bms_backup_engines_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupSummariesQueryObject { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, -} -pub mod bms_backup_summaries_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { - Invalid, - BackupProtectedItemCountSummary, - BackupProtectionContainerCountSummary, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsContainerQueryObject { - #[serde(rename = "backupManagementType")] - pub backup_management_type: bms_container_query_object::BackupManagementType, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_name: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -pub mod bms_container_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsContainersInquiryQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, -} -pub mod bms_containers_inquiry_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmspoQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -pub mod bmspo_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureSql, - AzureBackupServer, - AzureWorkload, - AzureStorage, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsrpQueryObject { - #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] - pub start_date: Option, - #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] - pub end_date: Option, - #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] - pub restore_point_query_type: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod bmsrp_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RestorePointQueryType { - Invalid, - Full, - Log, - Differential, - FullAndDifferential, - All, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsRefreshContainersQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bms_refresh_containers_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsWorkloadItemQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, -} -pub mod bms_workload_item_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureSql, - AzureBackupServer, - AzureWorkload, - AzureStorage, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBase { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, - #[serde(rename = "backupEngineState", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_state: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "backupEngineType", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_type: Option, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "backupEngineId", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_id: Option, - #[serde(rename = "dpmVersion", default, skip_serializing_if = "Option::is_none")] - pub dpm_version: Option, - #[serde(rename = "azureBackupAgentVersion", default, skip_serializing_if = "Option::is_none")] - pub azure_backup_agent_version: Option, - #[serde(rename = "isAzureBackupAgentUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub is_azure_backup_agent_upgrade_available: Option, - #[serde(rename = "isDpmUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub is_dpm_upgrade_available: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod backup_engine_base { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupEngineType { - Invalid, - DpmBackupEngine, - AzureBackupServerEngine, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBaseResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineBaseResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupEngineExtendedInfo { - #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] - pub database_name: Option, - #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] - pub protected_items_count: Option, - #[serde(rename = "protectedServersCount", default, skip_serializing_if = "Option::is_none")] - pub protected_servers_count: Option, - #[serde(rename = "diskCount", default, skip_serializing_if = "Option::is_none")] - pub disk_count: Option, - #[serde(rename = "usedDiskSpace", default, skip_serializing_if = "Option::is_none")] - pub used_disk_space: Option, - #[serde(rename = "availableDiskSpace", default, skip_serializing_if = "Option::is_none")] - pub available_disk_space: Option, - #[serde(rename = "refreshedAt", default, skip_serializing_if = "Option::is_none")] - pub refreshed_at: Option, - #[serde(rename = "azureProtectedInstances", default, skip_serializing_if = "Option::is_none")] - pub azure_protected_instances: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub unit: Option, - #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] - pub quota_period: Option, - #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] - pub next_reset_time: Option, - #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] - pub current_value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub limit: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, -} -pub mod backup_management_usage { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Unit { - Count, - Bytes, - Seconds, - Percent, - CountPerSecond, - BytesPerSecond, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsageList { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceVaultConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "enhancedSecurityState", default, skip_serializing_if = "Option::is_none")] - pub enhanced_security_state: Option, - #[serde(rename = "softDeleteFeatureState", default, skip_serializing_if = "Option::is_none")] - pub soft_delete_feature_state: Option, -} -pub mod backup_resource_vault_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum EnhancedSecurityState { - Invalid, - Enabled, - Disabled, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum SoftDeleteFeatureState { - Invalid, - Enabled, - Disabled, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceVaultConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] - pub po_logical_name: Option, -} -pub mod backup_status_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusResponse { - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, -} -pub mod backup_status_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum FabricName { - Invalid, - Azure, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryDisplay { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub provider: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForLogSpecification { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] - pub blob_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForProperties { - #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] - pub service_specification: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForServiceSpecification { - #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] - pub log_specifications: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryValueForSingleApi { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub display: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub origin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientScriptForConnect { - #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] - pub script_content: Option, - #[serde(rename = "scriptExtension", default, skip_serializing_if = "Option::is_none")] - pub script_extension: Option, - #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] - pub os_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(rename = "scriptNameSuffix", default, skip_serializing_if = "Option::is_none")] - pub script_name_suffix: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ContainerIdentityInfo { - #[serde(rename = "uniqueName", default, skip_serializing_if = "Option::is_none")] - pub unique_name: Option, - #[serde(rename = "aadTenantId", default, skip_serializing_if = "Option::is_none")] - pub aad_tenant_id: Option, - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmContainerExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmProtectedItem { - #[serde(flatten)] - pub protected_item: ProtectedItem, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod dpm_protected_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - #[serde(rename = "IRPending")] - IrPending, - Protected, - ProtectionError, - ProtectionStopped, - ProtectionPaused, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmProtectedItemExtendedInfo { - #[serde(rename = "protectableObjectLoadPath", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_load_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub protected: Option, - #[serde(rename = "isPresentOnCloud", default, skip_serializing_if = "Option::is_none")] - pub is_present_on_cloud: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, - #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub oldest_recovery_point: Option, - #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_count: Option, - #[serde(rename = "onPremiseOldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub on_premise_oldest_recovery_point: Option, - #[serde(rename = "onPremiseLatestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub on_premise_latest_recovery_point: Option, - #[serde(rename = "onPremiseRecoveryPointCount", default, skip_serializing_if = "Option::is_none")] - pub on_premise_recovery_point_count: Option, - #[serde(rename = "isCollocated", default, skip_serializing_if = "Option::is_none")] - pub is_collocated: Option, - #[serde(rename = "protectionGroupName", default, skip_serializing_if = "Option::is_none")] - pub protection_group_name: Option, - #[serde(rename = "diskStorageUsedInBytes", default, skip_serializing_if = "Option::is_none")] - pub disk_storage_used_in_bytes: Option, - #[serde(rename = "totalDiskStorageSizeInBytes", default, skip_serializing_if = "Option::is_none")] - pub total_disk_storage_size_in_bytes: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DailyRetentionFormat { - #[serde(rename = "daysOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] - pub days_of_the_month: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DailyRetentionSchedule { - #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] - pub retention_times: Vec, - #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] - pub retention_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct Day { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub date: Option, - #[serde(rename = "isLast", default, skip_serializing_if = "Option::is_none")] - pub is_last: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DiskExclusionProperties { - #[serde(rename = "diskLunList", default, skip_serializing_if = "Vec::is_empty")] - pub disk_lun_list: Vec, - #[serde(rename = "isInclusionList", default, skip_serializing_if = "Option::is_none")] - pub is_inclusion_list: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DiskInformation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lun: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DistributedNodesInfo { - #[serde(rename = "nodeName", default, skip_serializing_if = "Option::is_none")] - pub node_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmBackupEngine { - #[serde(flatten)] - pub backup_engine_base: BackupEngineBase, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, - #[serde(rename = "dpmAgentVersion", default, skip_serializing_if = "Option::is_none")] - pub dpm_agent_version: Option, - #[serde(rename = "dpmServers", default, skip_serializing_if = "Vec::is_empty")] - pub dpm_servers: Vec, - #[serde(rename = "upgradeAvailable", default, skip_serializing_if = "Option::is_none")] - pub upgrade_available: Option, - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmErrorInfo { - #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] - pub error_string: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmJob { - #[serde(flatten)] - pub job: Job, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration: Option, - #[serde(rename = "dpmServerName", default, skip_serializing_if = "Option::is_none")] - pub dpm_server_name: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] - pub actions_info: Vec, - #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] - pub error_details: Vec, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmJobExtendedInfo { - #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] - pub tasks_list: Vec, - #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] - pub property_bag: Option, - #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] - pub dynamic_error_message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DpmJobTaskDetails { - #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] - pub task_id: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct EncryptionDetails { - #[serde(rename = "encryptionEnabled", default, skip_serializing_if = "Option::is_none")] - pub encryption_enabled: Option, - #[serde(rename = "kekUrl", default, skip_serializing_if = "Option::is_none")] - pub kek_url: Option, - #[serde(rename = "secretKeyUrl", default, skip_serializing_if = "Option::is_none")] - pub secret_key_url: Option, - #[serde(rename = "kekVaultId", default, skip_serializing_if = "Option::is_none")] - pub kek_vault_id: Option, - #[serde(rename = "secretKeyVaultId", default, skip_serializing_if = "Option::is_none")] - pub secret_key_vault_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ErrorAdditionalInfo { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ErrorDetail { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ErrorResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub target: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub details: Vec, - #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] - pub additional_info: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ExportJobsOperationResultInfo { - #[serde(flatten)] - pub operation_result_info_base: OperationResultInfoBase, - #[serde(rename = "blobUrl", default, skip_serializing_if = "Option::is_none")] - pub blob_url: Option, - #[serde(rename = "blobSasKey", default, skip_serializing_if = "Option::is_none")] - pub blob_sas_key: Option, - #[serde(rename = "excelFileBlobUrl", default, skip_serializing_if = "Option::is_none")] - pub excel_file_blob_url: Option, - #[serde(rename = "excelFileBlobSasKey", default, skip_serializing_if = "Option::is_none")] - pub excel_file_blob_sas_key: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ExtendedProperties { - #[serde(rename = "diskExclusionProperties", default, skip_serializing_if = "Option::is_none")] - pub disk_exclusion_properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct FeatureSupportRequest { - #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] - pub feature_type: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "extendedInformation", default, skip_serializing_if = "Option::is_none")] - pub extended_information: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericContainerExtendedInfo { - #[serde(rename = "rawCertData", default, skip_serializing_if = "Option::is_none")] - pub raw_cert_data: Option, - #[serde(rename = "containerIdentityInfo", default, skip_serializing_if = "Option::is_none")] - pub container_identity_info: Option, - #[serde(rename = "serviceEndpoints", default, skip_serializing_if = "Option::is_none")] - pub service_endpoints: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericProtectedItem { - #[serde(flatten)] - pub protected_item: ProtectedItem, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] - pub policy_state: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, - #[serde(rename = "protectedItemId", default, skip_serializing_if = "Option::is_none")] - pub protected_item_id: Option, - #[serde(rename = "sourceAssociations", default, skip_serializing_if = "Option::is_none")] - pub source_associations: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, -} -pub mod generic_protected_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - #[serde(rename = "IRPending")] - IrPending, - Protected, - ProtectionError, - ProtectionStopped, - ProtectionPaused, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericProtectionPolicy { - #[serde(flatten)] - pub protection_policy: ProtectionPolicy, - #[serde(rename = "subProtectionPolicy", default, skip_serializing_if = "Vec::is_empty")] - pub sub_protection_policy: Vec, - #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] - pub time_zone: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GenericRecoveryPoint { - #[serde(flatten)] - pub recovery_point: RecoveryPoint, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_type: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_additional_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GetProtectedItemQueryObject { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expand: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IlrRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IlrRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaaSvmContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_version: Option, - #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] - pub resource_group: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaaSvmProtectableItem { - #[serde(flatten)] - pub workload_protectable_item: WorkloadProtectableItem, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmBackupRequest { - #[serde(flatten)] - pub backup_request: BackupRequest, - #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_expiry_time_in_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmilrRegistrationRequest { - #[serde(flatten)] - pub ilr_request: IlrRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_id: Option, - #[serde(rename = "initiatorName", default, skip_serializing_if = "Option::is_none")] - pub initiator_name: Option, - #[serde(rename = "renewExistingRegistration", default, skip_serializing_if = "Option::is_none")] - pub renew_existing_registration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmRecoveryPoint { - #[serde(flatten)] - pub recovery_point: RecoveryPoint, - #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_type: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_additional_info: Option, - #[serde(rename = "sourceVMStorageType", default, skip_serializing_if = "Option::is_none")] - pub source_vm_storage_type: Option, - #[serde(rename = "isSourceVMEncrypted", default, skip_serializing_if = "Option::is_none")] - pub is_source_vm_encrypted: Option, - #[serde(rename = "keyAndSecret", default, skip_serializing_if = "Option::is_none")] - pub key_and_secret: Option, - #[serde(rename = "isInstantIlrSessionActive", default, skip_serializing_if = "Option::is_none")] - pub is_instant_ilr_session_active: Option, - #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] - pub recovery_point_tier_details: Vec, - #[serde(rename = "isManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub is_managed_virtual_machine: Option, - #[serde(rename = "virtualMachineSize", default, skip_serializing_if = "Option::is_none")] - pub virtual_machine_size: Option, - #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] - pub original_storage_account_option: Option, - #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] - pub os_type: Option, - #[serde(rename = "recoveryPointDiskConfiguration", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_disk_configuration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IaasVmRestoreRequest { - #[serde(flatten)] - pub restore_request: RestoreRequest, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] - pub recovery_type: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] - pub target_virtual_machine_id: Option, - #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] - pub target_resource_group_id: Option, - #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] - pub storage_account_id: Option, - #[serde(rename = "virtualNetworkId", default, skip_serializing_if = "Option::is_none")] - pub virtual_network_id: Option, - #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] - pub subnet_id: Option, - #[serde(rename = "targetDomainNameId", default, skip_serializing_if = "Option::is_none")] - pub target_domain_name_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub region: Option, - #[serde(rename = "affinityGroup", default, skip_serializing_if = "Option::is_none")] - pub affinity_group: Option, - #[serde(rename = "createNewCloudService", default, skip_serializing_if = "Option::is_none")] - pub create_new_cloud_service: Option, - #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] - pub original_storage_account_option: Option, - #[serde(rename = "encryptionDetails", default, skip_serializing_if = "Option::is_none")] - pub encryption_details: Option, - #[serde(rename = "restoreDiskLunList", default, skip_serializing_if = "Vec::is_empty")] - pub restore_disk_lun_list: Vec, -} -pub mod iaas_vm_restore_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RecoveryType { - Invalid, - OriginalLocation, - AlternateLocation, - RestoreDisks, - Offline, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InquiryInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, - #[serde(rename = "inquiryDetails", default, skip_serializing_if = "Vec::is_empty")] - pub inquiry_details: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InquiryValidation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] - pub error_detail: Option, - #[serde(rename = "additionalDetail", default, skip_serializing_if = "Option::is_none")] - pub additional_detail: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InstantItemRecoveryTarget { - #[serde(rename = "clientScripts", default, skip_serializing_if = "Vec::is_empty")] - pub client_scripts: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InstantRpAdditionalDetails { - #[serde(rename = "azureBackupRGNamePrefix", default, skip_serializing_if = "Option::is_none")] - pub azure_backup_rg_name_prefix: Option, - #[serde(rename = "azureBackupRGNameSuffix", default, skip_serializing_if = "Option::is_none")] - pub azure_backup_rg_name_suffix: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct Job { - #[serde(rename = "entityFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub entity_friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, - #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] - pub activity_id: Option, - #[serde(rename = "jobType")] - pub job_type: String, -} -pub mod job { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct JobQueryObject { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] - pub job_id: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, -} -pub mod job_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - InProgress, - Completed, - Failed, - CompletedWithWarnings, - Cancelled, - Cancelling, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Operation { - Invalid, - Register, - UnRegister, - ConfigureBackup, - Backup, - Restore, - DisableBackup, - DeleteBackupData, - CrossRegionRestore, - Undelete, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct JobResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct JobResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct KekDetails { - #[serde(rename = "keyUrl", default, skip_serializing_if = "Option::is_none")] - pub key_url: Option, - #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] - pub key_vault_id: Option, - #[serde(rename = "keyBackupData", default, skip_serializing_if = "Option::is_none")] - pub key_backup_data: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct KpiResourceHealthDetails { - #[serde(rename = "resourceHealthStatus", default, skip_serializing_if = "Option::is_none")] - pub resource_health_status: Option, - #[serde(rename = "resourceHealthDetails", default, skip_serializing_if = "Vec::is_empty")] - pub resource_health_details: Vec, -} -pub mod kpi_resource_health_details { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceHealthStatus { - Healthy, - TransientDegraded, - PersistentDegraded, - TransientUnhealthy, - PersistentUnhealthy, - Invalid, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct KeyAndSecretDetails { - #[serde(rename = "kekDetails", default, skip_serializing_if = "Option::is_none")] - pub kek_details: Option, - #[serde(rename = "bekDetails", default, skip_serializing_if = "Option::is_none")] - pub bek_details: Option, - #[serde(rename = "encryptionMechanism", default, skip_serializing_if = "Option::is_none")] - pub encryption_mechanism: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LogSchedulePolicy { - #[serde(flatten)] - pub schedule_policy: SchedulePolicy, - #[serde(rename = "scheduleFrequencyInMins", default, skip_serializing_if = "Option::is_none")] - pub schedule_frequency_in_mins: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LongTermRetentionPolicy { - #[serde(flatten)] - pub retention_policy: RetentionPolicy, - #[serde(rename = "dailySchedule", default, skip_serializing_if = "Option::is_none")] - pub daily_schedule: Option, - #[serde(rename = "weeklySchedule", default, skip_serializing_if = "Option::is_none")] - pub weekly_schedule: Option, - #[serde(rename = "monthlySchedule", default, skip_serializing_if = "Option::is_none")] - pub monthly_schedule: Option, - #[serde(rename = "yearlySchedule", default, skip_serializing_if = "Option::is_none")] - pub yearly_schedule: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LongTermSchedulePolicy { - #[serde(flatten)] - pub schedule_policy: SchedulePolicy, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainerHealthDetails { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub title: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainer { - #[serde(flatten)] - pub protection_container: ProtectionContainer, - #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] - pub can_re_register: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] - pub protected_item_count: Option, - #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] - pub agent_version: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, - #[serde(rename = "mabContainerHealthDetails", default, skip_serializing_if = "Vec::is_empty")] - pub mab_container_health_details: Vec, - #[serde(rename = "containerHealthState", default, skip_serializing_if = "Option::is_none")] - pub container_health_state: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabContainerExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, - #[serde(rename = "backupItemType", default, skip_serializing_if = "Option::is_none")] - pub backup_item_type: Option, - #[serde(rename = "backupItems", default, skip_serializing_if = "Vec::is_empty")] - pub backup_items: Vec, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, -} -pub mod mab_container_extended_info { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupItemType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabErrorInfo { - #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] - pub error_string: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabFileFolderProtectedItem { - #[serde(flatten)] - pub protected_item: ProtectedItem, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] - pub computer_name: Option, - #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] - pub last_backup_status: Option, - #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] - pub last_backup_time: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, - #[serde(rename = "deferredDeleteSyncTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub deferred_delete_sync_time_in_utc: Option, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabFileFolderProtectedItemExtendedInfo { - #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] - pub last_refreshed_at: Option, - #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub oldest_recovery_point: Option, - #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_count: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabJob { - #[serde(flatten)] - pub job: Job, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration: Option, - #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] - pub actions_info: Vec, - #[serde(rename = "mabServerName", default, skip_serializing_if = "Option::is_none")] - pub mab_server_name: Option, - #[serde(rename = "mabServerType", default, skip_serializing_if = "Option::is_none")] - pub mab_server_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] - pub error_details: Vec, - #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] - pub extended_info: Option, -} -pub mod mab_job { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum MabServerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabJobExtendedInfo { - #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] - pub tasks_list: Vec, - #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] - pub property_bag: Option, - #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] - pub dynamic_error_message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabJobTaskDetails { - #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] - pub task_id: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MabProtectionPolicy { - #[serde(flatten)] - pub protection_policy: ProtectionPolicy, - #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] - pub schedule_policy: Option, - #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] - pub retention_policy: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MonthlyRetentionSchedule { - #[serde(rename = "retentionScheduleFormatType", default, skip_serializing_if = "Option::is_none")] - pub retention_schedule_format_type: Option, - #[serde(rename = "retentionScheduleDaily", default, skip_serializing_if = "Option::is_none")] - pub retention_schedule_daily: Option, - #[serde(rename = "retentionScheduleWeekly", default, skip_serializing_if = "Option::is_none")] - pub retention_schedule_weekly: Option, - #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] - pub retention_times: Vec, - #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] - pub retention_duration: Option, -} -pub mod monthly_retention_schedule { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RetentionScheduleFormatType { - Invalid, - Daily, - Weekly, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct NameInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] - pub localized_value: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationResultInfo { - #[serde(flatten)] - pub operation_result_info_base: OperationResultInfoBase, - #[serde(rename = "jobList", default, skip_serializing_if = "Vec::is_empty")] - pub job_list: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationResultInfoBase { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationResultInfoBaseResource { - #[serde(flatten)] - pub operation_worker_response: OperationWorkerResponse, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatus { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, -} -pub mod operation_status { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - InProgress, - Succeeded, - Failed, - Canceled, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusError { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusExtendedInfo { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusJobExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] - pub job_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusJobsExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "jobIds", default, skip_serializing_if = "Vec::is_empty")] - pub job_ids: Vec, - #[serde(rename = "failedJobsError", default, skip_serializing_if = "Option::is_none")] - pub failed_jobs_error: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusProvisionIlrExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "recoveryTarget", default, skip_serializing_if = "Option::is_none")] - pub recovery_target: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationWorkerResponse { - #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] - pub status_code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub headers: Option, -} -pub mod operation_worker_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StatusCode { - Continue, - SwitchingProtocols, - #[serde(rename = "OK")] - Ok, - Created, - Accepted, - NonAuthoritativeInformation, - NoContent, - ResetContent, - PartialContent, - MultipleChoices, - Ambiguous, - MovedPermanently, - Moved, - Found, - Redirect, - SeeOther, - RedirectMethod, - NotModified, - UseProxy, - Unused, - TemporaryRedirect, - RedirectKeepVerb, - BadRequest, - Unauthorized, - PaymentRequired, - Forbidden, - NotFound, - MethodNotAllowed, - NotAcceptable, - ProxyAuthenticationRequired, - RequestTimeout, - Conflict, - Gone, - LengthRequired, - PreconditionFailed, - RequestEntityTooLarge, - RequestUriTooLong, - UnsupportedMediaType, - RequestedRangeNotSatisfiable, - ExpectationFailed, - UpgradeRequired, - InternalServerError, - NotImplemented, - BadGateway, - ServiceUnavailable, - GatewayTimeout, - HttpVersionNotSupported, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PointInTimeRange { - #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] - pub start_time: Option, - #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] - pub end_time: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreBackupValidation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, -} -pub mod pre_backup_validation { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Success, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -pub mod pre_validate_enable_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub recommendation: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, -} -pub mod pre_validate_enable_backup_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Succeeded, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PrivateEndpoint { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PrivateEndpointConnection { - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] - pub private_endpoint: Option, - #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] - pub private_link_service_connection_state: Option, -} -pub mod private_endpoint_connection { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProvisioningState { - Succeeded, - Deleting, - Failed, - Pending, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PrivateEndpointConnectionResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PrivateLinkServiceConnectionState { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(rename = "actionRequired", default, skip_serializing_if = "Option::is_none")] - pub action_required: Option, -} -pub mod private_link_service_connection_state { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Pending, - Approved, - Rejected, - Disconnected, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainer { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "protectableContainerType", default, skip_serializing_if = "Option::is_none")] - pub protectable_container_type: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, -} -pub mod protectable_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectableContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainerResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectableContainerResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectedItem { - #[serde(rename = "protectedItemType")] - pub protected_item_type: String, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, - #[serde(rename = "lastRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub last_recovery_point: Option, - #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] - pub backup_set_name: Option, - #[serde(rename = "createMode", default, skip_serializing_if = "Option::is_none")] - pub create_mode: Option, - #[serde(rename = "deferredDeleteTimeInUTC", default, skip_serializing_if = "Option::is_none")] - pub deferred_delete_time_in_utc: Option, - #[serde(rename = "isScheduledForDeferredDelete", default, skip_serializing_if = "Option::is_none")] - pub is_scheduled_for_deferred_delete: Option, - #[serde(rename = "deferredDeleteTimeRemaining", default, skip_serializing_if = "Option::is_none")] - pub deferred_delete_time_remaining: Option, - #[serde(rename = "isDeferredDeleteScheduleUpcoming", default, skip_serializing_if = "Option::is_none")] - pub is_deferred_delete_schedule_upcoming: Option, - #[serde(rename = "isRehydrate", default, skip_serializing_if = "Option::is_none")] - pub is_rehydrate: Option, -} -pub mod protected_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum CreateMode { - Invalid, - Default, - Recover, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectedItemQueryObject { - #[serde(rename = "healthState", default, skip_serializing_if = "Option::is_none")] - pub health_state: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] - pub item_type: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] - pub backup_engine_name: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] - pub backup_set_name: Option, -} -pub mod protected_item_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum HealthState { - Passed, - ActionRequired, - ActionSuggested, - Invalid, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ItemType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectedItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectedItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainer { - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, - #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] - pub health_status: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, -} -pub mod protection_container { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ContainerType { - Invalid, - Unknown, - #[serde(rename = "IaasVMContainer")] - IaasVmContainer, - #[serde(rename = "IaasVMServiceContainer")] - IaasVmServiceContainer, - #[serde(rename = "DPMContainer")] - DpmContainer, - AzureBackupServerContainer, - #[serde(rename = "MABContainer")] - MabContainer, - Cluster, - AzureSqlContainer, - Windows, - VCenter, - #[serde(rename = "VMAppContainer")] - VmAppContainer, - #[serde(rename = "SQLAGWorkLoadContainer")] - SqlagWorkLoadContainer, - StorageContainer, - GenericContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainerResource { - #[serde(flatten)] - pub resource: Resource, +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionContainerResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntent { - #[serde(rename = "protectionIntentItemType", default, skip_serializing_if = "Option::is_none")] - pub protection_intent_item_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "itemId", default, skip_serializing_if = "Option::is_none")] - pub item_id: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] - pub item_type: Option, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "itemName", default, skip_serializing_if = "Option::is_none")] - pub item_name: Option, +pub struct OperationStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, } -pub mod protection_intent_query_object { +pub mod operation_status { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ItemType { + pub enum Status { Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLAvailabilityGroupContainer")] - SqlAvailabilityGroupContainer, + InProgress, + Succeeded, + Failed, + Canceled, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResource { - #[serde(flatten)] - pub resource: Resource, +pub struct OperationStatusError { #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionPolicy { - #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] - pub protected_items_count: Option, - #[serde(rename = "backupManagementType")] - pub backup_management_type: String, +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionPolicyQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, +pub struct PrivateEndpointConnection { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, } -pub mod protection_policy_query_object { +pub mod private_endpoint_connection { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, + pub enum ProvisioningState { + Succeeded, + Deleting, + Failed, + Pending, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionPolicyResource { +pub struct PrivateEndpointConnectionResource { #[serde(flatten)] pub resource: Resource, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionPolicyResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RecoveryPoint { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RecoveryPointDiskConfiguration { - #[serde(rename = "numberOfDisksIncludedInBackup", default, skip_serializing_if = "Option::is_none")] - pub number_of_disks_included_in_backup: Option, - #[serde(rename = "numberOfDisksAttachedToVm", default, skip_serializing_if = "Option::is_none")] - pub number_of_disks_attached_to_vm: Option, - #[serde(rename = "includedDiskList", default, skip_serializing_if = "Vec::is_empty")] - pub included_disk_list: Vec, - #[serde(rename = "excludedDiskList", default, skip_serializing_if = "Vec::is_empty")] - pub excluded_disk_list: Vec, + pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RecoveryPointResource { - #[serde(flatten)] - pub resource: Resource, +pub struct PrivateLinkServiceConnectionState { #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RecoveryPointResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RecoveryPointTierInformation { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub status: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, + pub description: Option, + #[serde(rename = "actionRequired", default, skip_serializing_if = "Option::is_none")] + pub action_required: Option, } -pub mod recovery_point_tier_information { +pub mod private_link_service_connection_state { use super::*; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { - Invalid, - #[serde(rename = "InstantRP")] - InstantRp, - #[serde(rename = "HardenedRP")] - HardenedRp, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum Status { - Invalid, - Valid, - Disabled, - Deleted, + Pending, + Approved, + Rejected, + Disconnected, } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -3424,352 +120,3 @@ pub struct Resource { #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] pub e_tag: Option, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ResourceHealthDetails { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub title: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub recommendations: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ResourceList { - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RestoreFileSpecs { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(rename = "fileSpecType", default, skip_serializing_if = "Option::is_none")] - pub file_spec_type: Option, - #[serde(rename = "targetFolderPath", default, skip_serializing_if = "Option::is_none")] - pub target_folder_path: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RestoreRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RetentionDuration { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub count: Option, - #[serde(rename = "durationType", default, skip_serializing_if = "Option::is_none")] - pub duration_type: Option, -} -pub mod retention_duration { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum DurationType { - Invalid, - Days, - Weeks, - Months, - Years, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RetentionPolicy { - #[serde(rename = "retentionPolicyType")] - pub retention_policy_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SqlDataDirectory { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(rename = "logicalName", default, skip_serializing_if = "Option::is_none")] - pub logical_name: Option, -} -pub mod sql_data_directory { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { - Invalid, - Data, - Log, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SqlDataDirectoryMapping { - #[serde(rename = "mappingType", default, skip_serializing_if = "Option::is_none")] - pub mapping_type: Option, - #[serde(rename = "sourceLogicalName", default, skip_serializing_if = "Option::is_none")] - pub source_logical_name: Option, - #[serde(rename = "sourcePath", default, skip_serializing_if = "Option::is_none")] - pub source_path: Option, - #[serde(rename = "targetPath", default, skip_serializing_if = "Option::is_none")] - pub target_path: Option, -} -pub mod sql_data_directory_mapping { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum MappingType { - Invalid, - Data, - Log, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SchedulePolicy { - #[serde(rename = "schedulePolicyType")] - pub schedule_policy_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct Settings { - #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] - pub time_zone: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub issqlcompression: Option, - #[serde(rename = "isCompression", default, skip_serializing_if = "Option::is_none")] - pub is_compression: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SimpleRetentionPolicy { - #[serde(flatten)] - pub retention_policy: RetentionPolicy, - #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] - pub retention_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SimpleSchedulePolicy { - #[serde(flatten)] - pub schedule_policy: SchedulePolicy, - #[serde(rename = "scheduleRunFrequency", default, skip_serializing_if = "Option::is_none")] - pub schedule_run_frequency: Option, - #[serde(rename = "scheduleRunDays", default, skip_serializing_if = "Vec::is_empty")] - pub schedule_run_days: Vec, - #[serde(rename = "scheduleRunTimes", default, skip_serializing_if = "Vec::is_empty")] - pub schedule_run_times: Vec, - #[serde(rename = "scheduleWeeklyFrequency", default, skip_serializing_if = "Option::is_none")] - pub schedule_weekly_frequency: Option, -} -pub mod simple_schedule_policy { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ScheduleRunFrequency { - Invalid, - Daily, - Weekly, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SubProtectionPolicy { - #[serde(rename = "policyType", default, skip_serializing_if = "Option::is_none")] - pub policy_type: Option, - #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] - pub schedule_policy: Option, - #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] - pub retention_policy: Option, -} -pub mod sub_protection_policy { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum PolicyType { - Invalid, - Full, - Differential, - Log, - CopyOnlyFull, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TargetAfsRestoreInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] - pub target_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TargetRestoreInfo { - #[serde(rename = "overwriteOption", default, skip_serializing_if = "Option::is_none")] - pub overwrite_option: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] - pub database_name: Option, - #[serde(rename = "targetDirectoryForFileRestore", default, skip_serializing_if = "Option::is_none")] - pub target_directory_for_file_restore: Option, -} -pub mod target_restore_info { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum OverwriteOption { - Invalid, - FailOnConflict, - Overwrite, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TokenInformation { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub token: Option, - #[serde(rename = "expiryTimeInUtcTicks", default, skip_serializing_if = "Option::is_none")] - pub expiry_time_in_utc_ticks: Option, - #[serde(rename = "securityPIN", default, skip_serializing_if = "Option::is_none")] - pub security_pin: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ValidateIaasVmRestoreOperationRequest { - #[serde(flatten)] - pub validate_restore_operation_request: ValidateRestoreOperationRequest, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ValidateOperationRequest { - #[serde(rename = "objectType")] - pub object_type: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ValidateOperationResponse { - #[serde(rename = "validationResults", default, skip_serializing_if = "Vec::is_empty")] - pub validation_results: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ValidateOperationsResponse { - #[serde(rename = "validateOperationResponse", default, skip_serializing_if = "Option::is_none")] - pub validate_operation_response: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ValidateRestoreOperationRequest { - #[serde(flatten)] - pub validate_operation_request: ValidateOperationRequest, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WeeklyRetentionFormat { - #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] - pub days_of_the_week: Vec, - #[serde(rename = "weeksOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] - pub weeks_of_the_month: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WeeklyRetentionSchedule { - #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] - pub days_of_the_week: Vec, - #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] - pub retention_times: Vec, - #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] - pub retention_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadInquiryDetails { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - #[serde(rename = "itemCount", default, skip_serializing_if = "Option::is_none")] - pub item_count: Option, - #[serde(rename = "inquiryValidation", default, skip_serializing_if = "Option::is_none")] - pub inquiry_validation: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItem { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod workload_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItem { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] - pub workload_type: Option, - #[serde(rename = "protectableItemType", default, skip_serializing_if = "Option::is_none")] - pub protectable_item_type: Option, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod workload_protectable_item { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItemResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadProtectableItemResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct YearlyRetentionSchedule { - #[serde(rename = "retentionScheduleFormatType", default, skip_serializing_if = "Option::is_none")] - pub retention_schedule_format_type: Option, - #[serde(rename = "monthsOfYear", default, skip_serializing_if = "Vec::is_empty")] - pub months_of_year: Vec, - #[serde(rename = "retentionScheduleDaily", default, skip_serializing_if = "Option::is_none")] - pub retention_schedule_daily: Option, - #[serde(rename = "retentionScheduleWeekly", default, skip_serializing_if = "Option::is_none")] - pub retention_schedule_weekly: Option, - #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] - pub retention_times: Vec, - #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] - pub retention_duration: Option, -} -pub mod yearly_retention_schedule { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum RetentionScheduleFormatType { - Invalid, - Daily, - Weekly, - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2020_02/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2020_02/operations.rs index 288b0b4561..4dcd3607b6 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2020_02/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2020_02/operations.rs @@ -74,123 +74,9 @@ impl Client { pipeline, } } - pub fn backup_engines(&self) -> backup_engines::Client { - backup_engines::Client(self.clone()) - } - pub fn backup_jobs(&self) -> backup_jobs::Client { - backup_jobs::Client(self.clone()) - } - pub fn backup_operation_results(&self) -> backup_operation_results::Client { - backup_operation_results::Client(self.clone()) - } - pub fn backup_operation_statuses(&self) -> backup_operation_statuses::Client { - backup_operation_statuses::Client(self.clone()) - } - pub fn backup_policies(&self) -> backup_policies::Client { - backup_policies::Client(self.clone()) - } - pub fn backup_protectable_items(&self) -> backup_protectable_items::Client { - backup_protectable_items::Client(self.clone()) - } - pub fn backup_protected_items(&self) -> backup_protected_items::Client { - backup_protected_items::Client(self.clone()) - } - pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { - backup_protection_containers::Client(self.clone()) - } - pub fn backup_protection_intent(&self) -> backup_protection_intent::Client { - backup_protection_intent::Client(self.clone()) - } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } - pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { - backup_resource_vault_configs::Client(self.clone()) - } - pub fn backup_status(&self) -> backup_status::Client { - backup_status::Client(self.clone()) - } - pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { - backup_usage_summaries::Client(self.clone()) - } - pub fn backup_workload_items(&self) -> backup_workload_items::Client { - backup_workload_items::Client(self.clone()) - } - pub fn backups(&self) -> backups::Client { - backups::Client(self.clone()) - } - pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { - export_jobs_operation_results::Client(self.clone()) - } - pub fn feature_support(&self) -> feature_support::Client { - feature_support::Client(self.clone()) - } - pub fn item_level_recovery_connections(&self) -> item_level_recovery_connections::Client { - item_level_recovery_connections::Client(self.clone()) - } - pub fn job_cancellations(&self) -> job_cancellations::Client { - job_cancellations::Client(self.clone()) - } - pub fn job_details(&self) -> job_details::Client { - job_details::Client(self.clone()) - } - pub fn job_operation_results(&self) -> job_operation_results::Client { - job_operation_results::Client(self.clone()) - } - pub fn jobs(&self) -> jobs::Client { - jobs::Client(self.clone()) - } - pub fn operation(&self) -> operation::Client { - operation::Client(self.clone()) - } - pub fn operations(&self) -> operations::Client { - operations::Client(self.clone()) - } pub fn private_endpoint_connection(&self) -> private_endpoint_connection::Client { private_endpoint_connection::Client(self.clone()) } - pub fn protectable_containers(&self) -> protectable_containers::Client { - protectable_containers::Client(self.clone()) - } - pub fn protected_item_operation_results(&self) -> protected_item_operation_results::Client { - protected_item_operation_results::Client(self.clone()) - } - pub fn protected_item_operation_statuses(&self) -> protected_item_operation_statuses::Client { - protected_item_operation_statuses::Client(self.clone()) - } - pub fn protected_items(&self) -> protected_items::Client { - protected_items::Client(self.clone()) - } - pub fn protection_container_operation_results(&self) -> protection_container_operation_results::Client { - protection_container_operation_results::Client(self.clone()) - } - pub fn protection_container_refresh_operation_results(&self) -> protection_container_refresh_operation_results::Client { - protection_container_refresh_operation_results::Client(self.clone()) - } - pub fn protection_containers(&self) -> protection_containers::Client { - protection_containers::Client(self.clone()) - } - pub fn protection_intent(&self) -> protection_intent::Client { - protection_intent::Client(self.clone()) - } - pub fn protection_policies(&self) -> protection_policies::Client { - protection_policies::Client(self.clone()) - } - pub fn protection_policy_operation_results(&self) -> protection_policy_operation_results::Client { - protection_policy_operation_results::Client(self.clone()) - } - pub fn protection_policy_operation_statuses(&self) -> protection_policy_operation_statuses::Client { - protection_policy_operation_statuses::Client(self.clone()) - } - pub fn recovery_points(&self) -> recovery_points::Client { - recovery_points::Client(self.clone()) - } - pub fn restores(&self) -> restores::Client { - restores::Client(self.clone()) - } - pub fn security_pi_ns(&self) -> security_pi_ns::Client { - security_pi_ns::Client(self.clone()) - } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -204,118 +90,6 @@ pub enum Error { PrivateEndpointConnection_Delete(#[from] private_endpoint_connection::delete::Error), #[error(transparent)] GetOperationStatus(#[from] get_operation_status::Error), - #[error(transparent)] - BackupResourceVaultConfigs_Get(#[from] backup_resource_vault_configs::get::Error), - #[error(transparent)] - BackupResourceVaultConfigs_Put(#[from] backup_resource_vault_configs::put::Error), - #[error(transparent)] - BackupResourceVaultConfigs_Update(#[from] backup_resource_vault_configs::update::Error), - #[error(transparent)] - ProtectedItems_Get(#[from] protected_items::get::Error), - #[error(transparent)] - ProtectedItems_CreateOrUpdate(#[from] protected_items::create_or_update::Error), - #[error(transparent)] - ProtectedItems_Delete(#[from] protected_items::delete::Error), - #[error(transparent)] - ProtectedItemOperationResults_Get(#[from] protected_item_operation_results::get::Error), - #[error(transparent)] - RecoveryPoints_List(#[from] recovery_points::list::Error), - #[error(transparent)] - RecoveryPoints_Get(#[from] recovery_points::get::Error), - #[error(transparent)] - Restores_Trigger(#[from] restores::trigger::Error), - #[error(transparent)] - BackupPolicies_List(#[from] backup_policies::list::Error), - #[error(transparent)] - ProtectionPolicies_Get(#[from] protection_policies::get::Error), - #[error(transparent)] - ProtectionPolicies_CreateOrUpdate(#[from] protection_policies::create_or_update::Error), - #[error(transparent)] - ProtectionPolicyOperationResults_Get(#[from] protection_policy_operation_results::get::Error), - #[error(transparent)] - BackupJobs_List(#[from] backup_jobs::list::Error), - #[error(transparent)] - JobDetails_Get(#[from] job_details::get::Error), - #[error(transparent)] - JobCancellations_Trigger(#[from] job_cancellations::trigger::Error), - #[error(transparent)] - JobOperationResults_Get(#[from] job_operation_results::get::Error), - #[error(transparent)] - ExportJobsOperationResults_Get(#[from] export_jobs_operation_results::get::Error), - #[error(transparent)] - Jobs_Export(#[from] jobs::export::Error), - #[error(transparent)] - BackupProtectedItems_List(#[from] backup_protected_items::list::Error), - #[error(transparent)] - Operation_Validate(#[from] operation::validate::Error), - #[error(transparent)] - ProtectionIntent_Validate(#[from] protection_intent::validate::Error), - #[error(transparent)] - BackupStatus_Get(#[from] backup_status::get::Error), - #[error(transparent)] - FeatureSupport_Validate(#[from] feature_support::validate::Error), - #[error(transparent)] - ProtectionIntent_Get(#[from] protection_intent::get::Error), - #[error(transparent)] - ProtectionIntent_CreateOrUpdate(#[from] protection_intent::create_or_update::Error), - #[error(transparent)] - ProtectionIntent_Delete(#[from] protection_intent::delete::Error), - #[error(transparent)] - BackupProtectionIntent_List(#[from] backup_protection_intent::list::Error), - #[error(transparent)] - BackupUsageSummaries_List(#[from] backup_usage_summaries::list::Error), - #[error(transparent)] - BackupEngines_List(#[from] backup_engines::list::Error), - #[error(transparent)] - BackupEngines_Get(#[from] backup_engines::get::Error), - #[error(transparent)] - ProtectionContainerRefreshOperationResults_Get(#[from] protection_container_refresh_operation_results::get::Error), - #[error(transparent)] - ProtectableContainers_List(#[from] protectable_containers::list::Error), - #[error(transparent)] - ProtectionContainers_Get(#[from] protection_containers::get::Error), - #[error(transparent)] - ProtectionContainers_Register(#[from] protection_containers::register::Error), - #[error(transparent)] - ProtectionContainers_Unregister(#[from] protection_containers::unregister::Error), - #[error(transparent)] - ProtectionContainers_Inquire(#[from] protection_containers::inquire::Error), - #[error(transparent)] - BackupWorkloadItems_List(#[from] backup_workload_items::list::Error), - #[error(transparent)] - ProtectionContainerOperationResults_Get(#[from] protection_container_operation_results::get::Error), - #[error(transparent)] - Backups_Trigger(#[from] backups::trigger::Error), - #[error(transparent)] - ProtectedItemOperationStatuses_Get(#[from] protected_item_operation_statuses::get::Error), - #[error(transparent)] - ItemLevelRecoveryConnections_Provision(#[from] item_level_recovery_connections::provision::Error), - #[error(transparent)] - ItemLevelRecoveryConnections_Revoke(#[from] item_level_recovery_connections::revoke::Error), - #[error(transparent)] - ProtectionContainers_Refresh(#[from] protection_containers::refresh::Error), - #[error(transparent)] - BackupOperationResults_Get(#[from] backup_operation_results::get::Error), - #[error(transparent)] - BackupOperationStatuses_Get(#[from] backup_operation_statuses::get::Error), - #[error(transparent)] - ProtectionPolicies_Delete(#[from] protection_policies::delete::Error), - #[error(transparent)] - ProtectionPolicyOperationStatuses_Get(#[from] protection_policy_operation_statuses::get::Error), - #[error(transparent)] - BackupProtectableItems_List(#[from] backup_protectable_items::list::Error), - #[error(transparent)] - BackupProtectionContainers_List(#[from] backup_protection_containers::list::Error), - #[error(transparent)] - SecurityPiNs_Get(#[from] security_pi_ns::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - Operations_List(#[from] operations::list::Error), } pub mod private_endpoint_connection { use super::{models, API_VERSION}; @@ -692,5346 +466,3 @@ pub mod get_operation_status { } } } -pub mod backup_resource_vault_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn put( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> put::Builder { - put::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceVaultConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod put { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceVaultConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceVaultConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceVaultConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceVaultConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protected_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - pub fn create_or_update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - parameters: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - parameters: parameters.into(), - } - } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod create_or_update { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectedItemResource), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) parameters: models::ProtectedItemResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protected_item_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectedItemResource), - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod recovery_points { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod restores { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn trigger( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::RestoreRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/restore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_policies { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionPolicyResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_policies { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - } - } - pub fn create_or_update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - parameters: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - parameters: parameters.into(), - } - } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.policy_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionPolicyResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod create_or_update { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionPolicyResource), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - pub(crate) parameters: models::ProtectionPolicyResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.policy_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionPolicyResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.policy_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_policy_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionPolicyResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - job_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - job_name: job_name.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) job_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.job_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod job_cancellations { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn trigger( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - job_name: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - job_name: job_name.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) job_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}/cancel", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.job_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod job_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - job_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - job_name: job_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) job_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . job_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod export_jobs_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::OperationResultInfoBaseResource), - Accepted202(models::OperationResultInfoBaseResource), - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationResultInfoBaseResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationResultInfoBaseResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Accepted202(rsp_value)) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn export( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> export::Builder { - export::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod export { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobsExport", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod operation { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn validate( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::ValidateOperationRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupValidateOperation", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ValidateOperationsResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate followings\r\n1. Vault capacity\r\n2. VM is already protected\r\n3. Any VM related configuration passed in properties."] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - pub fn create_or_update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - parameters: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - parameters: parameters.into(), - } - } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::PreValidateEnableBackupRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupPreValidateProtection", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PreValidateEnableBackupResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod create_or_update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - pub(crate) parameters: models::ProtectionIntentResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get the container backup status"] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupStatusRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupStatus", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupStatusResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod feature_support { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate if given feature with resource properties is supported in service"] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::FeatureSupportRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> - { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupValidateFeatures", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AzureVmResourceFeatureSupportResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionIntents", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_usage_summaries { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_engines { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - backup_engine_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - backup_engine_name: backup_engine_name.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupEngineBaseResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) backup_engine_name: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.backup_engine_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupEngineBaseResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_container_refresh_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protectable_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectableContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectableContainerResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - } - } - pub fn register( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - parameters: impl Into, - ) -> register::Builder { - register::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - parameters: parameters.into(), - } - } - pub fn unregister( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> unregister::Builder { - unregister::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - } - } - #[doc = "Inquires all the protectable items under the given container."] - pub fn inquire( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> inquire::Builder { - inquire::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - filter: None, - } - } - pub fn refresh( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - ) -> refresh::Builder { - refresh::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod register { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionContainerResource), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) parameters: models::ProtectionContainerResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod unregister { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod inquire { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/inquire" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod refresh { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/refreshContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_workload_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/items" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::WorkloadItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_container_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200(models::ProtectionContainerResource), - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backups { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn trigger( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) parameters: models::BackupRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protected_item_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationsStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod item_level_recovery_connections { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn provision( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> provision::Builder { - provision::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } - pub fn revoke( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - ) -> revoke::Builder { - revoke::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - } - } - } - pub mod provision { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::IlrRequestResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/provisionInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod revoke { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/revokeInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::ACCEPTED => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperations/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod protection_policy_operation_statuses { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - policy_name: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - policy_name: policy_name.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) policy_name: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protectable_items { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectableItems", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::WorkloadProtectableItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_containers { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionContainers", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionContainerResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod security_pi_ns { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupSecurityPIN", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TokenInformation = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod operations { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ClientDiscoveryResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2020_12/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2020_12/models.rs index 2c0f27bfc6..3f2c4f4290 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2020_12/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2020_12/models.rs @@ -3,31 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupGoalFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupServerContainer { #[serde(flatten)] pub dpm_container: DpmContainer, @@ -383,18 +358,6 @@ pub struct AzureIaaSvmProtectionPolicy { pub time_zone: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureRecoveryServiceVaultProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureResourceProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureSqlagWorkloadContainerProtectionContainer { #[serde(flatten)] pub azure_workload_container: AzureWorkloadContainer, @@ -515,33 +478,6 @@ pub struct AzureVmAppContainerProtectionContainer { pub azure_workload_container: AzureWorkloadContainer, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, - #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] - pub vm_size: Option, - #[serde(rename = "vmSku", default, skip_serializing_if = "Option::is_none")] - pub vm_sku: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportResponse { - #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] - pub support_status: Option, -} -pub mod azure_vm_resource_feature_support_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum SupportStatus { - Invalid, - Supported, - #[serde(rename = "DefaultOFF")] - DefaultOff, - #[serde(rename = "DefaultON")] - DefaultOn, - NotSupported, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmWorkloadItem { #[serde(flatten)] pub workload_item: WorkloadItem, @@ -765,11 +701,6 @@ pub struct AzureVmWorkloadSqlInstanceWorkloadItem { pub data_directory_paths: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadAutoProtectionIntent { - #[serde(flatten)] - pub azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadBackupRequest { #[serde(flatten)] pub backup_request: BackupRequest, @@ -982,32 +913,6 @@ pub struct AzureWorkloadSapHanaRestoreRequest { pub azure_workload_restore_request: AzureWorkloadRestoreRequest, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlAutoProtectionIntent { - #[serde(flatten)] - pub azure_workload_auto_protection_intent: AzureWorkloadAutoProtectionIntent, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, -} -pub mod azure_workload_sql_auto_protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { #[serde(flatten)] pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, @@ -1056,29 +961,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1111,20 +993,6 @@ pub mod bms_backup_engines_query_object { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupSummariesQueryObject { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, -} -pub mod bms_backup_summaries_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { - Invalid, - BackupProtectedItemCountSummary, - BackupProtectionContainerCountSummary, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsContainerQueryObject { #[serde(rename = "backupManagementType")] pub backup_management_type: bms_container_query_object::BackupManagementType, @@ -1496,38 +1364,6 @@ pub struct BackupEngineExtendedInfo { pub azure_protected_instances: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub unit: Option, - #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] - pub quota_period: Option, - #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] - pub next_reset_time: Option, - #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] - pub current_value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub limit: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, -} -pub mod backup_management_usage { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Unit { - Count, - Bytes, - Seconds, - Percent, - CountPerSecond, - BytesPerSecond, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsageList { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupRequest { #[serde(rename = "objectType")] pub object_type: String, @@ -1540,49 +1376,6 @@ pub struct BackupRequestResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_flag: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupResourceEncryptionConfig { #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] pub encryption_at_rest_type: Option, @@ -1684,127 +1477,6 @@ pub struct BackupResourceVaultConfigResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] - pub po_logical_name: Option, -} -pub mod backup_status_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusResponse { - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, -} -pub mod backup_status_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum FabricName { - Invalid, - Azure, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryDisplay { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub provider: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForLogSpecification { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] - pub blob_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForProperties { - #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] - pub service_specification: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForServiceSpecification { - #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] - pub log_specifications: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryValueForSingleApi { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub display: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub origin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClientScriptForConnect { #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] pub script_content: Option, @@ -1829,96 +1501,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2159,11 +1741,6 @@ pub struct ExtendedProperties { pub disk_exclusion_properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct FeatureSupportRequest { - #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] - pub feature_type: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct GenericContainer { #[serde(flatten)] pub protection_container: ProtectionContainer, @@ -2376,20 +1953,6 @@ pub mod iaas_vm_restore_request { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityInfo { - #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] - pub is_system_assigned_identity: Option, - #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] - pub managed_identity_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InquiryInfo { #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, @@ -2818,13 +2381,6 @@ pub mod monthly_retention_schedule { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct NameInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] - pub localized_value: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct NewErrorResponse { #[serde(default, skip_serializing_if = "Option::is_none")] pub error: Option, @@ -2928,15 +2484,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -3023,68 +2570,6 @@ pub mod pre_backup_validation { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -pub mod pre_validate_enable_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub recommendation: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, -} -pub mod pre_validate_enable_backup_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Succeeded, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PrepareDataMoveRequest { #[serde(rename = "targetResourceId")] pub target_resource_id: String, @@ -3467,98 +2952,6 @@ pub struct ProtectionContainerResourceList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntent { - #[serde(rename = "protectionIntentItemType", default, skip_serializing_if = "Option::is_none")] - pub protection_intent_item_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "itemId", default, skip_serializing_if = "Option::is_none")] - pub item_id: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] - pub item_type: Option, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "itemName", default, skip_serializing_if = "Option::is_none")] - pub item_name: Option, -} -pub mod protection_intent_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLAvailabilityGroupContainer")] - SqlAvailabilityGroupContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ProtectionPolicy { #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] pub protected_items_count: Option, @@ -3647,13 +3040,6 @@ pub struct RecoveryPointDiskConfiguration { pub excluded_disk_list: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RecoveryPointMoveReadinessInfo { - #[serde(rename = "isReadyForMove", default, skip_serializing_if = "Option::is_none")] - pub is_ready_for_move: Option, - #[serde(rename = "additionalInfo", default, skip_serializing_if = "Option::is_none")] - pub additional_info: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RecoveryPointResource { #[serde(flatten)] pub resource: Resource, @@ -4008,33 +3394,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2020_12/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2020_12/operations.rs index 99b3e8c0c1..712f811997 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2020_12/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2020_12/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,33 +95,15 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } - pub fn backup_protection_intent(&self) -> backup_protection_intent::Client { - backup_protection_intent::Client(self.clone()) - } pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } - pub fn backup_status(&self) -> backup_status::Client { - backup_status::Client(self.clone()) - } - pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { - backup_usage_summaries::Client(self.clone()) - } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -140,21 +113,9 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } - pub fn feature_support(&self) -> feature_support::Client { - feature_support::Client(self.clone()) - } pub fn item_level_recovery_connections(&self) -> item_level_recovery_connections::Client { item_level_recovery_connections::Client(self.clone()) } @@ -173,9 +134,6 @@ impl Client { pub fn operation(&self) -> operation::Client { operation::Client(self.clone()) } - pub fn operations(&self) -> operations::Client { - operations::Client(self.clone()) - } pub fn private_endpoint(&self) -> private_endpoint::Client { private_endpoint::Client(self.clone()) } @@ -203,9 +161,6 @@ impl Client { pub fn protection_containers(&self) -> protection_containers::Client { protection_containers::Client(self.clone()) } - pub fn protection_intent(&self) -> protection_intent::Client { - protection_intent::Client(self.clone()) - } pub fn protection_policies(&self) -> protection_policies::Client { protection_policies::Client(self.clone()) } @@ -218,9 +173,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn restores(&self) -> restores::Client { restores::Client(self.clone()) } @@ -340,50 +292,6 @@ pub enum Error { BackupProtectionContainers_List(#[from] backup_protection_containers::list::Error), #[error(transparent)] SecurityPiNs_Get(#[from] security_pi_ns::get::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), - #[error(transparent)] - ProtectionIntent_Validate(#[from] protection_intent::validate::Error), - #[error(transparent)] - BackupStatus_Get(#[from] backup_status::get::Error), - #[error(transparent)] - FeatureSupport_Validate(#[from] feature_support::validate::Error), - #[error(transparent)] - ProtectionIntent_Get(#[from] protection_intent::get::Error), - #[error(transparent)] - ProtectionIntent_CreateOrUpdate(#[from] protection_intent::create_or_update::Error), - #[error(transparent)] - ProtectionIntent_Delete(#[from] protection_intent::delete::Error), - #[error(transparent)] - BackupProtectionIntent_List(#[from] backup_protection_intent::list::Error), - #[error(transparent)] - BackupUsageSummaries_List(#[from] backup_usage_summaries::list::Error), - #[error(transparent)] - Operations_List(#[from] operations::list::Error), } pub mod backup_resource_vault_configs { use super::{models, API_VERSION}; @@ -2036,30 +1944,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -2208,86 +2092,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -5686,2032 +5490,3 @@ pub mod security_pi_ns { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate followings\r\n1. Vault capacity\r\n2. VM is already protected\r\n3. Any VM related configuration passed in properties."] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - pub fn create_or_update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - parameters: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - parameters: parameters.into(), - } - } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::PreValidateEnableBackupRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupPreValidateProtection", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PreValidateEnableBackupResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod create_or_update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - pub(crate) parameters: models::ProtectionIntentResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get the container backup status"] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupStatusRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupStatus", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupStatusResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod feature_support { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate if given feature with resource properties is supported in service"] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::FeatureSupportRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> - { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupValidateFeatures", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AzureVmResourceFeatureSupportResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionIntents", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_usage_summaries { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod operations { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ClientDiscoveryResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_01/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_01/models.rs index feba6e4a56..c94db26d8e 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_01/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_01/models.rs @@ -3,31 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBackupGoalFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupServerContainer { #[serde(flatten)] pub dpm_container: DpmContainer, @@ -383,18 +358,6 @@ pub struct AzureIaaSvmProtectionPolicy { pub time_zone: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureRecoveryServiceVaultProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureResourceProtectionIntent { - #[serde(flatten)] - pub protection_intent: ProtectionIntent, - #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureSqlagWorkloadContainerProtectionContainer { #[serde(flatten)] pub azure_workload_container: AzureWorkloadContainer, @@ -515,33 +478,6 @@ pub struct AzureVmAppContainerProtectionContainer { pub azure_workload_container: AzureWorkloadContainer, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportRequest { - #[serde(flatten)] - pub feature_support_request: FeatureSupportRequest, - #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] - pub vm_size: Option, - #[serde(rename = "vmSku", default, skip_serializing_if = "Option::is_none")] - pub vm_sku: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureVmResourceFeatureSupportResponse { - #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] - pub support_status: Option, -} -pub mod azure_vm_resource_feature_support_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum SupportStatus { - Invalid, - Supported, - #[serde(rename = "DefaultOFF")] - DefaultOff, - #[serde(rename = "DefaultON")] - DefaultOn, - NotSupported, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureVmWorkloadItem { #[serde(flatten)] pub workload_item: WorkloadItem, @@ -765,11 +701,6 @@ pub struct AzureVmWorkloadSqlInstanceWorkloadItem { pub data_directory_paths: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadAutoProtectionIntent { - #[serde(flatten)] - pub azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadBackupRequest { #[serde(flatten)] pub backup_request: BackupRequest, @@ -1000,32 +931,6 @@ pub struct AzureWorkloadSapHanaRestoreWithRehydrateRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureWorkloadSqlAutoProtectionIntent { - #[serde(flatten)] - pub azure_workload_auto_protection_intent: AzureWorkloadAutoProtectionIntent, - #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] - pub workload_item_type: Option, -} -pub mod azure_workload_sql_auto_protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum WorkloadItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - #[serde(rename = "SAPHanaSystem")] - SapHanaSystem, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseSystem")] - SapAseSystem, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { #[serde(flatten)] pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, @@ -1088,29 +993,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1143,20 +1025,6 @@ pub mod bms_backup_engines_query_object { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsBackupSummariesQueryObject { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, -} -pub mod bms_backup_summaries_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Type { - Invalid, - BackupProtectedItemCountSummary, - BackupProtectionContainerCountSummary, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsContainerQueryObject { #[serde(rename = "backupManagementType")] pub backup_management_type: bms_container_query_object::BackupManagementType, @@ -1530,38 +1398,6 @@ pub struct BackupEngineExtendedInfo { pub azure_protected_instances: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub unit: Option, - #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] - pub quota_period: Option, - #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] - pub next_reset_time: Option, - #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] - pub current_value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub limit: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, -} -pub mod backup_management_usage { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Unit { - Count, - Bytes, - Seconds, - Percent, - CountPerSecond, - BytesPerSecond, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupManagementUsageList { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupRequest { #[serde(rename = "objectType")] pub object_type: String, @@ -1574,49 +1410,6 @@ pub struct BackupRequestResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_flag: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupResourceEncryptionConfig { #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] pub encryption_at_rest_type: Option, @@ -1718,127 +1511,6 @@ pub struct BackupResourceVaultConfigResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] - pub po_logical_name: Option, -} -pub mod backup_status_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupStatusResponse { - #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] - pub protection_status: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] - pub fabric_name: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] - pub registration_status: Option, -} -pub mod backup_status_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionStatus { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum FabricName { - Invalid, - Azure, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryDisplay { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub provider: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForLogSpecification { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] - pub blob_duration: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForProperties { - #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] - pub service_specification: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryForServiceSpecification { - #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] - pub log_specifications: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ClientDiscoveryValueForSingleApi { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub display: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub origin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClientScriptForConnect { #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] pub script_content: Option, @@ -1881,96 +1553,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2198,11 +1780,6 @@ pub struct ExtendedProperties { pub disk_exclusion_properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct FeatureSupportRequest { - #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] - pub feature_type: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct GenericContainer { #[serde(flatten)] pub protection_container: ProtectionContainer, @@ -2424,20 +2001,6 @@ pub struct IaasVmRestoreWithRehydrationRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityInfo { - #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] - pub is_system_assigned_identity: Option, - #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] - pub managed_identity_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InquiryInfo { #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, @@ -2905,13 +2468,6 @@ pub mod move_rp_across_tiers_request { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct NameInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] - pub localized_value: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct NewErrorResponse { #[serde(default, skip_serializing_if = "Option::is_none")] pub error: Option, @@ -3015,15 +2571,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -3110,68 +2657,6 @@ pub mod pre_backup_validation { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupRequest { - #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] - pub vault_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -pub mod pre_validate_enable_backup_request { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ResourceType { - Invalid, - #[serde(rename = "VM")] - Vm, - FileFolder, - AzureSqlDb, - #[serde(rename = "SQLDB")] - Sqldb, - Exchange, - Sharepoint, - #[serde(rename = "VMwareVM")] - VMwareVm, - SystemState, - Client, - GenericDataSource, - #[serde(rename = "SQLDataBase")] - SqlDataBase, - AzureFileShare, - #[serde(rename = "SAPHanaDatabase")] - SapHanaDatabase, - #[serde(rename = "SAPAseDatabase")] - SapAseDatabase, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreValidateEnableBackupResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] - pub error_code: Option, - #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub recommendation: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] - pub protected_item_name: Option, -} -pub mod pre_validate_enable_backup_response { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum Status { - Invalid, - Succeeded, - Failed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PrepareDataMoveRequest { #[serde(rename = "targetResourceId")] pub target_resource_id: String, @@ -3554,98 +3039,6 @@ pub struct ProtectionContainerResourceList { pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntent { - #[serde(rename = "protectionIntentItemType", default, skip_serializing_if = "Option::is_none")] - pub protection_intent_item_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] - pub source_resource_id: Option, - #[serde(rename = "itemId", default, skip_serializing_if = "Option::is_none")] - pub item_id: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, - #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] - pub protection_state: Option, -} -pub mod protection_intent { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ProtectionState { - Invalid, - NotProtected, - Protecting, - Protected, - ProtectionFailed, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] - pub item_type: Option, - #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] - pub parent_name: Option, - #[serde(rename = "itemName", default, skip_serializing_if = "Option::is_none")] - pub item_name: Option, -} -pub mod protection_intent_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum ItemType { - Invalid, - #[serde(rename = "SQLInstance")] - SqlInstance, - #[serde(rename = "SQLAvailabilityGroupContainer")] - SqlAvailabilityGroupContainer, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectionIntentResourceList { - #[serde(flatten)] - pub resource_list: ResourceList, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ProtectionPolicy { #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] pub protected_items_count: Option, @@ -4112,33 +3505,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_01/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_01/operations.rs index c3be068ed2..e2e46cec39 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_01/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_01/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,33 +95,15 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } - pub fn backup_protection_intent(&self) -> backup_protection_intent::Client { - backup_protection_intent::Client(self.clone()) - } pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } - pub fn backup_status(&self) -> backup_status::Client { - backup_status::Client(self.clone()) - } - pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { - backup_usage_summaries::Client(self.clone()) - } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -140,21 +113,9 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } - pub fn feature_support(&self) -> feature_support::Client { - feature_support::Client(self.clone()) - } pub fn item_level_recovery_connections(&self) -> item_level_recovery_connections::Client { item_level_recovery_connections::Client(self.clone()) } @@ -173,9 +134,6 @@ impl Client { pub fn operation(&self) -> operation::Client { operation::Client(self.clone()) } - pub fn operations(&self) -> operations::Client { - operations::Client(self.clone()) - } pub fn private_endpoint(&self) -> private_endpoint::Client { private_endpoint::Client(self.clone()) } @@ -203,9 +161,6 @@ impl Client { pub fn protection_containers(&self) -> protection_containers::Client { protection_containers::Client(self.clone()) } - pub fn protection_intent(&self) -> protection_intent::Client { - protection_intent::Client(self.clone()) - } pub fn protection_policies(&self) -> protection_policies::Client { protection_policies::Client(self.clone()) } @@ -218,9 +173,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -347,50 +299,6 @@ pub enum Error { MoveRecoveryPoint(#[from] move_recovery_point::Error), #[error(transparent)] RecoveryPointsRecommendedForMove_List(#[from] recovery_points_recommended_for_move::list::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), - #[error(transparent)] - ProtectionIntent_Validate(#[from] protection_intent::validate::Error), - #[error(transparent)] - BackupStatus_Get(#[from] backup_status::get::Error), - #[error(transparent)] - FeatureSupport_Validate(#[from] feature_support::validate::Error), - #[error(transparent)] - ProtectionIntent_Get(#[from] protection_intent::get::Error), - #[error(transparent)] - ProtectionIntent_CreateOrUpdate(#[from] protection_intent::create_or_update::Error), - #[error(transparent)] - ProtectionIntent_Delete(#[from] protection_intent::delete::Error), - #[error(transparent)] - BackupProtectionIntent_List(#[from] backup_protection_intent::list::Error), - #[error(transparent)] - BackupUsageSummaries_List(#[from] backup_usage_summaries::list::Error), - #[error(transparent)] - Operations_List(#[from] operations::list::Error), } pub mod backup_resource_vault_configs { use super::{models, API_VERSION}; @@ -2166,30 +2074,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -2348,86 +2232,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -6106,2032 +5910,3 @@ pub mod recovery_points_recommended_for_move { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate followings\r\n1. Vault capacity\r\n2. VM is already protected\r\n3. Any VM related configuration passed in properties."] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - pub fn create_or_update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - parameters: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - parameters: parameters.into(), - } - } - pub fn delete( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - intent_object_name: impl Into, - ) -> delete::Builder { - delete::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - intent_object_name: intent_object_name.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::PreValidateEnableBackupRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupPreValidateProtection", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PreValidateEnableBackupResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod create_or_update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - pub(crate) parameters: models::ProtectionIntentResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } - pub mod delete { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) intent_object_name: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get the container backup status"] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupStatusRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupStatus", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupStatusResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod feature_support { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "It will validate if given feature with resource properties is supported in service"] - pub fn validate( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> validate::Builder { - validate::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod validate { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::FeatureSupportRequest, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> - { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupValidateFeatures", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AzureVmResourceFeatureSupportResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_protection_intent { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionIntents", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectionIntentResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod backup_usage_summaries { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod operations { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ClientDiscoveryResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_02/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_02/models.rs index abbaab0b6a..7e054176bc 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_02/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_02/models.rs @@ -3,26 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupGoalFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -1088,29 +1068,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1574,49 +1531,6 @@ pub struct BackupRequestResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_flag: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupResourceEncryptionConfig { #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] pub encryption_at_rest_type: Option, @@ -1881,96 +1795,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2424,20 +2248,6 @@ pub struct IaasVmRestoreWithRehydrationRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityInfo { - #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] - pub is_system_assigned_identity: Option, - #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] - pub managed_identity_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InquiryInfo { #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, @@ -3015,15 +2825,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -4112,33 +3913,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_02/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_02/operations.rs index a5f506f43a..4f0a470cee 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_02/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_02/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,9 +95,6 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } @@ -116,9 +104,6 @@ impl Client { pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } @@ -128,9 +113,6 @@ impl Client { pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -140,15 +122,6 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } @@ -218,9 +191,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -365,32 +335,6 @@ pub enum Error { MoveRecoveryPoint(#[from] move_recovery_point::Error), #[error(transparent)] RecoveryPointsRecommendedForMove_List(#[from] recovery_points_recommended_for_move::list::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), } pub mod protection_intent { use super::{models, API_VERSION}; @@ -2993,30 +2937,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -3175,86 +3095,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -6933,1205 +6773,3 @@ pub mod recovery_points_recommended_for_move { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_02_10/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_02_10/models.rs index abbaab0b6a..7e054176bc 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_02_10/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_02_10/models.rs @@ -3,26 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupGoalFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -1088,29 +1068,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1574,49 +1531,6 @@ pub struct BackupRequestResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_flag: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupResourceEncryptionConfig { #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] pub encryption_at_rest_type: Option, @@ -1881,96 +1795,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2424,20 +2248,6 @@ pub struct IaasVmRestoreWithRehydrationRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityInfo { - #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] - pub is_system_assigned_identity: Option, - #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] - pub managed_identity_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InquiryInfo { #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, @@ -3015,15 +2825,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -4112,33 +3913,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_02_10/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_02_10/operations.rs index a5f506f43a..4f0a470cee 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_02_10/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_02_10/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,9 +95,6 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } @@ -116,9 +104,6 @@ impl Client { pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } @@ -128,9 +113,6 @@ impl Client { pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -140,15 +122,6 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } @@ -218,9 +191,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -365,32 +335,6 @@ pub enum Error { MoveRecoveryPoint(#[from] move_recovery_point::Error), #[error(transparent)] RecoveryPointsRecommendedForMove_List(#[from] recovery_points_recommended_for_move::list::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), } pub mod protection_intent { use super::{models, API_VERSION}; @@ -2993,30 +2937,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -3175,86 +3095,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -6933,1205 +6773,3 @@ pub mod recovery_points_recommended_for_move { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_02_preview/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_02_preview/models.rs index 985c7e6b7a..f0b927fc92 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_02_preview/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_02_preview/models.rs @@ -3,26 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupGoalFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -1088,29 +1068,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1574,49 +1531,6 @@ pub struct BackupRequestResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_flag: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupResourceEncryptionConfig { #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] pub encryption_at_rest_type: Option, @@ -1883,96 +1797,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2426,20 +2250,6 @@ pub struct IaasVmRestoreWithRehydrationRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityInfo { - #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] - pub is_system_assigned_identity: Option, - #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] - pub managed_identity_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InquiryInfo { #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, @@ -3017,15 +2827,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -4154,33 +3955,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_02_preview/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_02_preview/operations.rs index e3f72da3d8..d1412882b9 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_02_preview/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_02_preview/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,9 +95,6 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } @@ -116,9 +104,6 @@ impl Client { pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } @@ -128,9 +113,6 @@ impl Client { pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -140,15 +122,6 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } @@ -218,9 +191,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -381,32 +351,6 @@ pub enum Error { ResourceGuardProxy_Delete(#[from] resource_guard_proxy::delete::Error), #[error(transparent)] ResourceGuardProxy_UnlockDelete(#[from] resource_guard_proxy::unlock_delete::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), } pub mod protection_intent { use super::{models, API_VERSION}; @@ -3009,30 +2953,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -3191,86 +3111,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -7410,1205 +7250,3 @@ pub mod resource_guard_proxy { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_03/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_03/models.rs index 7071a09372..514567738a 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_03/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_03/models.rs @@ -3,26 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupGoalFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -1090,29 +1070,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1576,49 +1533,6 @@ pub struct BackupRequestResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_flag: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupResourceEncryptionConfig { #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] pub encryption_at_rest_type: Option, @@ -1883,96 +1797,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2426,20 +2250,6 @@ pub struct IaasVmRestoreWithRehydrationRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityInfo { - #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] - pub is_system_assigned_identity: Option, - #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] - pub managed_identity_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InquiryInfo { #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, @@ -3017,15 +2827,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -4114,33 +3915,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_03/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_03/operations.rs index a5f506f43a..4f0a470cee 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_03/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_03/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,9 +95,6 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } @@ -116,9 +104,6 @@ impl Client { pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } @@ -128,9 +113,6 @@ impl Client { pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -140,15 +122,6 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } @@ -218,9 +191,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -365,32 +335,6 @@ pub enum Error { MoveRecoveryPoint(#[from] move_recovery_point::Error), #[error(transparent)] RecoveryPointsRecommendedForMove_List(#[from] recovery_points_recommended_for_move::list::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), } pub mod protection_intent { use super::{models, API_VERSION}; @@ -2993,30 +2937,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -3175,86 +3095,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -6933,1205 +6773,3 @@ pub mod recovery_points_recommended_for_move { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_04/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_04/models.rs index b84f5ced76..08f06fea39 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_04/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_04/models.rs @@ -3,26 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupGoalFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -1090,29 +1070,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1901,96 +1858,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2444,20 +2311,6 @@ pub struct IaasVmRestoreWithRehydrationRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityInfo { - #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] - pub is_system_assigned_identity: Option, - #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] - pub managed_identity_resource_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InquiryInfo { #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, @@ -3035,15 +2888,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -4132,33 +3976,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_04/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_04/operations.rs index e5ecb2e992..f744a5def9 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_04/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_04/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,9 +95,6 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } @@ -116,9 +104,6 @@ impl Client { pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_storage_configs_non_crr(&self) -> backup_resource_storage_configs_non_crr::Client { backup_resource_storage_configs_non_crr::Client(self.clone()) } @@ -131,9 +116,6 @@ impl Client { pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -143,15 +125,6 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } @@ -221,9 +194,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -374,32 +344,6 @@ pub enum Error { MoveRecoveryPoint(#[from] move_recovery_point::Error), #[error(transparent)] RecoveryPointsRecommendedForMove_List(#[from] recovery_points_recommended_for_move::list::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), } pub mod backup_resource_storage_configs_non_crr { use super::{models, API_VERSION}; @@ -3267,30 +3211,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -3449,86 +3369,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -7207,1205 +7047,3 @@ pub mod recovery_points_recommended_for_move { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_06/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_06/models.rs index 456654da0e..3999ecb11c 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_06/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_06/models.rs @@ -3,26 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupGoalFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -1090,29 +1070,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1576,49 +1533,6 @@ pub struct BackupRequestResource { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfig { - #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] - pub storage_model_type: Option, - #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] - pub storage_type: Option, - #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] - pub storage_type_state: Option, - #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_flag: Option, -} -pub mod backup_resource_config { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageModelType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageType { - Invalid, - GeoRedundant, - LocallyRedundant, - ZoneRedundant, - ReadAccessGeoZoneRedundant, - } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum StorageTypeState { - Invalid, - Locked, - Unlocked, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BackupResourceConfigResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BackupResourceEncryptionConfig { #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] pub encryption_at_rest_type: Option, @@ -1901,96 +1815,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2446,13 +2270,6 @@ pub struct IaasVmRestoreWithRehydrationRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct IdentityInfo { #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] pub is_system_assigned_identity: Option, @@ -3037,15 +2854,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -4134,33 +3942,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_06/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_06/operations.rs index 5cd36ea65d..8cc8ee5434 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_06/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_06/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,9 +95,6 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } @@ -116,9 +104,6 @@ impl Client { pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { backup_resource_vault_configs::Client(self.clone()) } @@ -128,9 +113,6 @@ impl Client { pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -140,15 +122,6 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } @@ -218,9 +191,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -365,32 +335,6 @@ pub enum Error { MoveRecoveryPoint(#[from] move_recovery_point::Error), #[error(transparent)] RecoveryPointsRecommendedForMove_List(#[from] recovery_points_recommended_for_move::list::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), } pub mod protection_intent { use super::{models, API_VERSION}; @@ -2993,30 +2937,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -3175,86 +3095,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -6933,1205 +6773,3 @@ pub mod recovery_points_recommended_for_move { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_07/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_07/models.rs index 707abc5e00..aca6c76421 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_07/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_07/models.rs @@ -3,26 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupGoalFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -1090,29 +1070,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1903,96 +1860,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -3041,15 +2908,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -4191,33 +4049,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_07/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_07/operations.rs index 5a3157e9e6..b300c0abc7 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_07/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_07/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,9 +95,6 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } @@ -116,9 +104,6 @@ impl Client { pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_storage_configs_non_crr(&self) -> backup_resource_storage_configs_non_crr::Client { backup_resource_storage_configs_non_crr::Client(self.clone()) } @@ -131,9 +116,6 @@ impl Client { pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -143,15 +125,6 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } @@ -221,9 +194,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -390,32 +360,6 @@ pub enum Error { ResourceGuardProxy_Delete(#[from] resource_guard_proxy::delete::Error), #[error(transparent)] ResourceGuardProxy_UnlockDelete(#[from] resource_guard_proxy::unlock_delete::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), } pub mod backup_resource_storage_configs_non_crr { use super::{models, API_VERSION}; @@ -3283,30 +3227,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -3465,86 +3385,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -7694,1205 +7534,3 @@ pub mod resource_guard_proxy { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_08/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_08/models.rs index 3a6799ec5a..abd50bd7be 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_08/models.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_08/models.rs @@ -3,26 +3,6 @@ #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadProperties { - #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_client_id: Option, - #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] - pub service_principal_object_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AadPropertiesResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AzureBackupGoalFeatureSupportRequest { #[serde(flatten)] pub feature_support_request: FeatureSupportRequest, @@ -1090,29 +1070,6 @@ pub struct BekDetails { pub secret_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BmsaadPropertiesQueryObject { - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, -} -pub mod bmsaad_properties_query_object { - use super::*; - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BackupManagementType { - Invalid, - #[serde(rename = "AzureIaasVM")] - AzureIaasVm, - #[serde(rename = "MAB")] - Mab, - #[serde(rename = "DPM")] - Dpm, - AzureBackupServer, - AzureSql, - AzureStorage, - AzureWorkload, - DefaultBackup, - } -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BmsBackupEngineQueryObject { #[serde(default, skip_serializing_if = "Option::is_none")] pub expand: Option, @@ -1903,96 +1860,6 @@ pub struct ContainerIdentityInfo { pub audience: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequest { - #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] - pub cross_region_restore_access_details: Option, - #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] - pub restore_request: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrossRegionRestoreRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessToken { - #[serde(rename = "objectType")] - pub object_type: String, - #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] - pub access_token_string: Option, - #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] - pub resource_group_name: Option, - #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] - pub resource_name: Option, - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] - pub protection_container_id: Option, - #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_id: Option, - #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] - pub recovery_point_time: Option, - #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] - pub container_name: Option, - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, - #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] - pub backup_management_type: Option, - #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] - pub datasource_type: Option, - #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] - pub datasource_name: Option, - #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] - pub datasource_id: Option, - #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] - pub datasource_container_name: Option, - #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_id: Option, - #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub coordinator_service_stamp_uri: Option, - #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_id: Option, - #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] - pub protection_service_stamp_uri: Option, - #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] - pub token_extended_information: Option, - #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] - pub rp_tier_information: Option, - #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] - pub rp_original_sa_option: Option, - #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] - pub rp_is_managed_virtual_machine: Option, - #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] - pub rp_vm_size_description: Option, - #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] - pub b_ms_active_region: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrAccessTokenResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequest { - #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] - pub job_name: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CrrJobRequestResource { - #[serde(flatten)] - pub resource: Resource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DpmContainerExtendedInfo { #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] pub last_refreshed_at: Option, @@ -2448,13 +2315,6 @@ pub struct IaasVmRestoreWithRehydrationRequest { pub recovery_point_rehydration_info: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityBasedRestoreDetails { - #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] - pub object_type: Option, - #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] - pub target_storage_account_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct IdentityInfo { #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] pub is_system_assigned_identity: Option, @@ -3039,15 +2899,6 @@ pub struct OperationStatusProvisionIlrExtendedInfo { pub recovery_target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OperationStatusRecoveryPointExtendedInfo { - #[serde(flatten)] - pub operation_status_extended_info: OperationStatusExtendedInfo, - #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] - pub updated_recovery_point: Option, - #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] - pub deleted_backup_item_version: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationWorkerResponse { #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] pub status_code: Option, @@ -4189,33 +4040,6 @@ pub struct WeeklyRetentionSchedule { pub retention_duration: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct WorkloadCrrAccessToken { - #[serde(flatten)] - pub crr_access_token: CrrAccessToken, - #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_unique_name: Option, - #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_friendly_name: Option, - #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_workload_type: Option, - #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_protection_state: Option, - #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] - pub protectable_object_container_host_os_name: Option, - #[serde( - rename = "protectableObjectParentLogicalContainerName", - default, - skip_serializing_if = "Option::is_none" - )] - pub protectable_object_parent_logical_container_name: Option, - #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] - pub policy_name: Option, - #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] - pub policy_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct WorkloadInquiryDetails { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_08/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_08/operations.rs index 5a3157e9e6..b300c0abc7 100644 --- a/services/mgmt/recoveryservicesbackup/src/package_2021_08/operations.rs +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_08/operations.rs @@ -74,15 +74,6 @@ impl Client { pipeline, } } - pub fn aad_properties(&self) -> aad_properties::Client { - aad_properties::Client(self.clone()) - } - pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { - backup_crr_job_details::Client(self.clone()) - } - pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { - backup_crr_jobs::Client(self.clone()) - } pub fn backup_engines(&self) -> backup_engines::Client { backup_engines::Client(self.clone()) } @@ -104,9 +95,6 @@ impl Client { pub fn backup_protected_items(&self) -> backup_protected_items::Client { backup_protected_items::Client(self.clone()) } - pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { - backup_protected_items_crr::Client(self.clone()) - } pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { backup_protection_containers::Client(self.clone()) } @@ -116,9 +104,6 @@ impl Client { pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { backup_resource_encryption_configs::Client(self.clone()) } - pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { - backup_resource_storage_configs::Client(self.clone()) - } pub fn backup_resource_storage_configs_non_crr(&self) -> backup_resource_storage_configs_non_crr::Client { backup_resource_storage_configs_non_crr::Client(self.clone()) } @@ -131,9 +116,6 @@ impl Client { pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { backup_usage_summaries::Client(self.clone()) } - pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { - backup_usage_summaries_crr::Client(self.clone()) - } pub fn backup_workload_items(&self) -> backup_workload_items::Client { backup_workload_items::Client(self.clone()) } @@ -143,15 +125,6 @@ impl Client { pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { bms_prepare_data_move_operation_result::Client(self.clone()) } - pub fn cross_region_restore(&self) -> cross_region_restore::Client { - cross_region_restore::Client(self.clone()) - } - pub fn crr_operation_results(&self) -> crr_operation_results::Client { - crr_operation_results::Client(self.clone()) - } - pub fn crr_operation_status(&self) -> crr_operation_status::Client { - crr_operation_status::Client(self.clone()) - } pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { export_jobs_operation_results::Client(self.clone()) } @@ -221,9 +194,6 @@ impl Client { pub fn recovery_points(&self) -> recovery_points::Client { recovery_points::Client(self.clone()) } - pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { - recovery_points_crr::Client(self.clone()) - } pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { recovery_points_recommended_for_move::Client(self.clone()) } @@ -390,32 +360,6 @@ pub enum Error { ResourceGuardProxy_Delete(#[from] resource_guard_proxy::delete::Error), #[error(transparent)] ResourceGuardProxy_UnlockDelete(#[from] resource_guard_proxy::unlock_delete::Error), - #[error(transparent)] - BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), - #[error(transparent)] - AadProperties_Get(#[from] aad_properties::get::Error), - #[error(transparent)] - CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), - #[error(transparent)] - BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), - #[error(transparent)] - BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), - #[error(transparent)] - CrrOperationResults_Get(#[from] crr_operation_results::get::Error), - #[error(transparent)] - CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), - #[error(transparent)] - RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), - #[error(transparent)] - BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), - #[error(transparent)] - RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), - #[error(transparent)] - BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), } pub mod backup_resource_storage_configs_non_crr { use super::{models, API_VERSION}; @@ -3283,30 +3227,6 @@ pub mod recovery_points { recovery_point_id: recovery_point_id.into(), } } - #[doc = "Returns the Access token for communication between BMS and Protection service"] - pub fn get_access_token( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - recovery_point_id: impl Into, - parameters: impl Into, - ) -> get_access_token::Builder { - get_access_token::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - recovery_point_id: recovery_point_id.into(), - parameters: parameters.into(), - } - } } pub mod list { use super::{models, API_VERSION}; @@ -3465,86 +3385,6 @@ pub mod recovery_points { } } } - pub mod get_access_token { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - BadRequest400 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) recovery_point_id: String, - pub(crate) parameters: models::AadPropertiesResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CrrAccessTokenResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } } pub mod restores { use super::{models, API_VERSION}; @@ -7694,1205 +7534,3 @@ pub mod resource_guard_proxy { } } } -pub mod backup_usage_summaries_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupManagementUsageList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod aad_properties { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Fetches the AAD properties from target region BCM stamp."] - pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - filter: None, - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AadPropertiesResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod cross_region_restore { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] - pub fn trigger( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> trigger::Builder { - trigger::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod trigger { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrossRegionRestoreRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_job_details { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Get CRR job details from target region."] - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_crr_jobs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets the list of CRR jobs from the target region."] - pub fn list( - &self, - azure_region: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::CrrJobRequest, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::JobResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_results { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod crr_operation_status { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - azure_region: impl Into, - subscription_id: impl Into, - operation_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - azure_region: azure_region.into(), - subscription_id: subscription_id.into(), - operation_id: operation_id.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) azure_region: String, - pub(crate) subscription_id: String, - pub(crate) operation_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", - self.client.endpoint(), - &self.subscription_id, - &self.azure_region, - &self.operation_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationStatus = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_resource_storage_configs { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn patch( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> patch::Builder { - patch::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - } - pub mod get { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod update { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackupResourceConfigResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } - pub mod patch { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) parameters: models::BackupResourceConfigResource, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::NO_CONTENT => Ok(()), - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod recovery_points_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - fabric_name: impl Into, - container_name: impl Into, - protected_item_name: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - fabric_name: fabric_name.into(), - container_name: container_name.into(), - protected_item_name: protected_item_name.into(), - filter: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) fabric_name: String, - pub(crate) container_name: String, - pub(crate) protected_item_name: String, - pub(crate) filter: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecoveryPointResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} -pub mod backup_protected_items_crr { - use super::{models, API_VERSION}; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - vault_name: impl Into, - resource_group_name: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - vault_name: vault_name.into(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - filter: None, - skip_token: None, - } - } - } - pub mod list { - use super::{models, API_VERSION}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::NewErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrl(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequest(http::Error), - #[error("Failed to serialize request body: {0}")] - Serialize(serde_json::Error), - #[error("Failed to get access token: {0}")] - GetToken(azure_core::Error), - #[error("Failed to execute request: {0}")] - SendRequest(azure_core::Error), - #[error("Failed to get response bytes: {0}")] - ResponseBytes(azure_core::StreamError), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - Deserialize(serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) vault_name: String, - pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) skip_token: Option, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.vault_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", super::API_VERSION); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProtectedItemResourceList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NewErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - }) - } - } - } -} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_10/mod.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_10/mod.rs new file mode 100644 index 0000000000..cdd7552b47 --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_10/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-10-01"; diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_10/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_10/models.rs new file mode 100644 index 0000000000..00176ae7c5 --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_10/models.rs @@ -0,0 +1,4285 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupGoalFeatureSupportRequest { + #[serde(flatten)] + pub feature_support_request: FeatureSupportRequest, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupServerContainer { + #[serde(flatten)] + pub dpm_container: DpmContainer, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupServerEngine { + #[serde(flatten)] + pub backup_engine_base: BackupEngineBase, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareBackupRequest { + #[serde(flatten)] + pub backup_request: BackupRequest, + #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_expiry_time_in_utc: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareProtectableItem { + #[serde(flatten)] + pub workload_protectable_item: WorkloadProtectableItem, + #[serde(rename = "parentContainerFabricId", default, skip_serializing_if = "Option::is_none")] + pub parent_container_fabric_id: Option, + #[serde(rename = "parentContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub parent_container_friendly_name: Option, + #[serde(rename = "azureFileShareType", default, skip_serializing_if = "Option::is_none")] + pub azure_file_share_type: Option, +} +pub mod azure_file_share_protectable_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AzureFileShareType { + Invalid, + #[serde(rename = "XSMB")] + Xsmb, + XSync, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[serde(rename = "workLoadType", default, skip_serializing_if = "Option::is_none")] + pub work_load_type: Option, + #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] + pub schedule_policy: Option, + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +pub mod azure_file_share_protection_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkLoadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareProvisionIlrRequest { + #[serde(flatten)] + pub ilr_request: IlrRequest, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "fileShareSnapshotUri", default, skip_serializing_if = "Option::is_none")] + pub file_share_snapshot_uri: Option, + #[serde(rename = "recoveryPointSizeInGB", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_size_in_gb: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "copyOptions", default, skip_serializing_if = "Option::is_none")] + pub copy_options: Option, + #[serde(rename = "restoreRequestType", default, skip_serializing_if = "Option::is_none")] + pub restore_request_type: Option, + #[serde(rename = "restoreFileSpecs", default, skip_serializing_if = "Vec::is_empty")] + pub restore_file_specs: Vec, + #[serde(rename = "targetDetails", default, skip_serializing_if = "Option::is_none")] + pub target_details: Option, +} +pub mod azure_file_share_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CopyOptions { + Invalid, + CreateCopy, + Skip, + Overwrite, + FailOnConflict, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestoreRequestType { + Invalid, + FullShareRestore, + ItemLevelRestore, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileshareProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod azure_fileshare_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileshareProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[serde(rename = "resourceStateSyncTime", default, skip_serializing_if = "Option::is_none")] + pub resource_state_sync_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSClassicComputeVmContainer { + #[serde(flatten)] + pub iaa_svm_container: IaaSvmContainer, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSClassicComputeVmProtectableItem { + #[serde(flatten)] + pub iaa_svm_protectable_item: IaaSvmProtectableItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSClassicComputeVmProtectedItem { + #[serde(flatten)] + pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSComputeVmContainer { + #[serde(flatten)] + pub iaa_svm_container: IaaSvmContainer, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSComputeVmProtectableItem { + #[serde(flatten)] + pub iaa_svm_protectable_item: IaaSvmProtectableItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSComputeVmProtectedItem { + #[serde(flatten)] + pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] + pub error_title: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmHealthDetails { + #[serde(flatten)] + pub resource_health_details: ResourceHealthDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "isUserTriggered", default, skip_serializing_if = "Option::is_none")] + pub is_user_triggered: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "internalPropertyBag", default, skip_serializing_if = "Option::is_none")] + pub internal_property_bag: Option, + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, + #[serde(rename = "estimatedRemainingDuration", default, skip_serializing_if = "Option::is_none")] + pub estimated_remaining_duration: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "instanceId", default, skip_serializing_if = "Option::is_none")] + pub instance_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, + #[serde(rename = "taskExecutionDetails", default, skip_serializing_if = "Option::is_none")] + pub task_execution_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJobV2 { + #[serde(flatten)] + pub job: Job, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[serde(rename = "healthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_details: Vec, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_id: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "extendedProperties", default, skip_serializing_if = "Option::is_none")] + pub extended_properties: Option, +} +pub mod azure_iaa_svm_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthStatus { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyInconsistent", default, skip_serializing_if = "Option::is_none")] + pub policy_inconsistent: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[serde(rename = "instantRPDetails", default, skip_serializing_if = "Option::is_none")] + pub instant_rp_details: Option, + #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] + pub schedule_policy: Option, + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, + #[serde(rename = "instantRpRetentionRangeInDays", default, skip_serializing_if = "Option::is_none")] + pub instant_rp_retention_range_in_days: Option, + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureRecoveryServiceVaultProtectionIntent { + #[serde(flatten)] + pub protection_intent: ProtectionIntent, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceProtectionIntent { + #[serde(flatten)] + pub protection_intent: ProtectionIntent, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlagWorkloadContainerProtectionContainer { + #[serde(flatten)] + pub azure_workload_container: AzureWorkloadContainer, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_id: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod azure_sql_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] + pub storage_account_version: Option, + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[serde(rename = "acquireStorageAccountLock", default, skip_serializing_if = "Option::is_none")] + pub acquire_storage_account_lock: Option, +} +pub mod azure_storage_container { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AcquireStorageAccountLock { + Acquire, + NotAcquire, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_name: Option, + #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] + pub storage_account_version: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "isUserTriggered", default, skip_serializing_if = "Option::is_none")] + pub is_user_triggered: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageProtectableContainer { + #[serde(flatten)] + pub protectable_container: ProtectableContainer, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmAppContainerProtectableContainer { + #[serde(flatten)] + pub protectable_container: ProtectableContainer, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmAppContainerProtectionContainer { + #[serde(flatten)] + pub azure_workload_container: AzureWorkloadContainer, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmResourceFeatureSupportRequest { + #[serde(flatten)] + pub feature_support_request: FeatureSupportRequest, + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[serde(rename = "vmSku", default, skip_serializing_if = "Option::is_none")] + pub vm_sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmResourceFeatureSupportResponse { + #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] + pub support_status: Option, +} +pub mod azure_vm_resource_feature_support_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SupportStatus { + Invalid, + Supported, + #[serde(rename = "DefaultOFF")] + DefaultOff, + #[serde(rename = "DefaultON")] + DefaultOn, + NotSupported, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadItem { + #[serde(flatten)] + pub workload_item: WorkloadItem, + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] + pub server_name: Option, + #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] + pub is_auto_protectable: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subinquireditemcount: Option, + #[serde(rename = "subWorkloadItemCount", default, skip_serializing_if = "Option::is_none")] + pub sub_workload_item_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectableItem { + #[serde(flatten)] + pub workload_protectable_item: WorkloadProtectableItem, + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[serde(rename = "parentUniqueName", default, skip_serializing_if = "Option::is_none")] + pub parent_unique_name: Option, + #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] + pub server_name: Option, + #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] + pub is_auto_protectable: Option, + #[serde(rename = "isAutoProtected", default, skip_serializing_if = "Option::is_none")] + pub is_auto_protected: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subinquireditemcount: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subprotectableitemcount: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prebackupvalidation: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] + pub server_name: Option, + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[serde(rename = "parentType", default, skip_serializing_if = "Option::is_none")] + pub parent_type: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "lastBackupErrorDetail", default, skip_serializing_if = "Option::is_none")] + pub last_backup_error_detail: Option, + #[serde(rename = "protectedItemDataSourceId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_source_id: Option, + #[serde(rename = "protectedItemHealthStatus", default, skip_serializing_if = "Option::is_none")] + pub protected_item_health_status: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, +} +pub mod azure_vm_workload_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastBackupStatus { + Invalid, + Healthy, + Unhealthy, + #[serde(rename = "IRPending")] + IrPending, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectedItemHealthStatus { + Invalid, + Healthy, + Unhealthy, + NotReachable, + #[serde(rename = "IRPending")] + IrPending, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[serde(rename = "recoveryModel", default, skip_serializing_if = "Option::is_none")] + pub recovery_model: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[serde(rename = "workLoadType", default, skip_serializing_if = "Option::is_none")] + pub work_load_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[serde(rename = "subProtectionPolicy", default, skip_serializing_if = "Vec::is_empty")] + pub sub_protection_policy: Vec, + #[serde(rename = "makePolicyConsistent", default, skip_serializing_if = "Option::is_none")] + pub make_policy_consistent: Option, +} +pub mod azure_vm_workload_protection_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkLoadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseDatabaseWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseSystemProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseSystemWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaDatabaseProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaDatabaseWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaSystemProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaSystemWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlAvailabilityGroupProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlDatabaseProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlDatabaseWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlInstanceProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlInstanceWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, + #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub data_directory_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadAutoProtectionIntent { + #[serde(flatten)] + pub azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadBackupRequest { + #[serde(flatten)] + pub backup_request: BackupRequest, + #[serde(rename = "backupType", default, skip_serializing_if = "Option::is_none")] + pub backup_type: Option, + #[serde(rename = "enableCompression", default, skip_serializing_if = "Option::is_none")] + pub enable_compression: Option, + #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_expiry_time_in_utc: Option, +} +pub mod azure_workload_backup_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupType { + Invalid, + Full, + Differential, + Log, + CopyOnlyFull, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, +} +pub mod azure_workload_container { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OperationType { + Invalid, + Register, + Reregister, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadContainerAutoProtectionIntent { + #[serde(flatten)] + pub protection_intent: ProtectionIntent, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadContainerExtendedInfo { + #[serde(rename = "hostServerName", default, skip_serializing_if = "Option::is_none")] + pub host_server_name: Option, + #[serde(rename = "inquiryInfo", default, skip_serializing_if = "Option::is_none")] + pub inquiry_info: Option, + #[serde(rename = "nodesList", default, skip_serializing_if = "Vec::is_empty")] + pub nodes_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] + pub error_title: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJob { + #[serde(flatten)] + pub job: Job, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, + #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub time_ranges: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time_in_utc: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_tier_details: Vec, + #[serde(rename = "recoveryPointMoveReadinessInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_move_readiness_info: Option, +} +pub mod azure_workload_recovery_point { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Full, + Log, + Differential, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "targetInfo", default, skip_serializing_if = "Option::is_none")] + pub target_info: Option, + #[serde(rename = "recoveryMode", default, skip_serializing_if = "Option::is_none")] + pub recovery_mode: Option, + #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_machine_id: Option, +} +pub mod azure_workload_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryMode { + Invalid, + FileRecovery, + WorkloadRecovery, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_point_in_time_recovery_point: AzureWorkloadPointInTimeRecoveryPoint, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest { + #[serde(flatten)] + pub azure_workload_sap_hana_point_in_time_restore_request: AzureWorkloadSapHanaPointInTimeRestoreRequest, + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRestoreWithRehydrateRequest { + #[serde(flatten)] + pub azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest, + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlAutoProtectionIntent { + #[serde(flatten)] + pub azure_workload_auto_protection_intent: AzureWorkloadAutoProtectionIntent, + #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] + pub workload_item_type: Option, +} +pub mod azure_workload_sql_auto_protection_intent { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadItemType { + Invalid, + #[serde(rename = "SQLInstance")] + SqlInstance, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + #[serde(rename = "SAPHanaSystem")] + SapHanaSystem, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseSystem")] + SapAseSystem, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, + #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub time_ranges: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest { + #[serde(flatten)] + pub azure_workload_sql_point_in_time_restore_request: AzureWorkloadSqlPointInTimeRestoreRequest, + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRecoveryPointExtendedInfo { + #[serde(rename = "dataDirectoryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub data_directory_time_in_utc: Option, + #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub data_directory_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, + #[serde(rename = "shouldUseAlternateTargetLocation", default, skip_serializing_if = "Option::is_none")] + pub should_use_alternate_target_location: Option, + #[serde(rename = "isNonRecoverable", default, skip_serializing_if = "Option::is_none")] + pub is_non_recoverable: Option, + #[serde(rename = "alternateDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub alternate_directory_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRestoreWithRehydrateRequest { + #[serde(flatten)] + pub azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest, + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BekDetails { + #[serde(rename = "secretUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_url: Option, + #[serde(rename = "secretVaultId", default, skip_serializing_if = "Option::is_none")] + pub secret_vault_id: Option, + #[serde(rename = "secretData", default, skip_serializing_if = "Option::is_none")] + pub secret_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsBackupEngineQueryObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expand: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsBackupEnginesQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expand: Option, +} +pub mod bms_backup_engines_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsBackupSummariesQueryObject { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod bms_backup_summaries_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + BackupProtectedItemCountSummary, + BackupProtectionContainerCountSummary, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsContainerQueryObject { + #[serde(rename = "backupManagementType")] + pub backup_management_type: bms_container_query_object::BackupManagementType, + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, +} +pub mod bms_container_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ContainerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsContainersInquiryQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, +} +pub mod bms_containers_inquiry_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmspoQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, +} +pub mod bmspo_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureSql, + AzureBackupServer, + AzureWorkload, + AzureStorage, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsrpQueryObject { + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] + pub restore_point_query_type: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "moveReadyRPOnly", default, skip_serializing_if = "Option::is_none")] + pub move_ready_rp_only: Option, +} +pub mod bmsrp_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestorePointQueryType { + Invalid, + Full, + Log, + Differential, + FullAndDifferential, + All, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsRefreshContainersQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, +} +pub mod bms_refresh_containers_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsWorkloadItemQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] + pub workload_item_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, +} +pub mod bms_workload_item_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureSql, + AzureBackupServer, + AzureWorkload, + AzureStorage, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadItemType { + Invalid, + #[serde(rename = "SQLInstance")] + SqlInstance, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + #[serde(rename = "SAPHanaSystem")] + SapHanaSystem, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseSystem")] + SapAseSystem, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionStatus { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupEngineBase { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] + pub registration_status: Option, + #[serde(rename = "backupEngineState", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_state: Option, + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[serde(rename = "backupEngineType")] + pub backup_engine_type: backup_engine_base::BackupEngineType, + #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] + pub can_re_register: Option, + #[serde(rename = "backupEngineId", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_id: Option, + #[serde(rename = "dpmVersion", default, skip_serializing_if = "Option::is_none")] + pub dpm_version: Option, + #[serde(rename = "azureBackupAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub azure_backup_agent_version: Option, + #[serde(rename = "isAzureBackupAgentUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_azure_backup_agent_upgrade_available: Option, + #[serde(rename = "isDpmUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_dpm_upgrade_available: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod backup_engine_base { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupEngineType { + Invalid, + DpmBackupEngine, + AzureBackupServerEngine, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupEngineBaseResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupEngineBaseResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupEngineExtendedInfo { + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] + pub protected_items_count: Option, + #[serde(rename = "protectedServersCount", default, skip_serializing_if = "Option::is_none")] + pub protected_servers_count: Option, + #[serde(rename = "diskCount", default, skip_serializing_if = "Option::is_none")] + pub disk_count: Option, + #[serde(rename = "usedDiskSpace", default, skip_serializing_if = "Option::is_none")] + pub used_disk_space: Option, + #[serde(rename = "availableDiskSpace", default, skip_serializing_if = "Option::is_none")] + pub available_disk_space: Option, + #[serde(rename = "refreshedAt", default, skip_serializing_if = "Option::is_none")] + pub refreshed_at: Option, + #[serde(rename = "azureProtectedInstances", default, skip_serializing_if = "Option::is_none")] + pub azure_protected_instances: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupManagementUsage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] + pub next_reset_time: Option, + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +pub mod backup_management_usage { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupManagementUsageList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupRequest { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceConfig { + #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] + pub storage_model_type: Option, + #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] + pub storage_type: Option, + #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] + pub storage_type_state: Option, + #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] + pub cross_region_restore_flag: Option, + #[serde(rename = "dedupState", default, skip_serializing_if = "Option::is_none")] + pub dedup_state: Option, + #[serde(rename = "xcoolState", default, skip_serializing_if = "Option::is_none")] + pub xcool_state: Option, +} +pub mod backup_resource_config { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageModelType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageTypeState { + Invalid, + Locked, + Unlocked, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DedupState { + Invalid, + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum XcoolState { + Invalid, + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceConfigResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceEncryptionConfig { + #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] + pub encryption_at_rest_type: Option, + #[serde(rename = "keyUri", default, skip_serializing_if = "Option::is_none")] + pub key_uri: Option, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(rename = "lastUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub last_update_status: Option, + #[serde(rename = "infrastructureEncryptionState", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_encryption_state: Option, +} +pub mod backup_resource_encryption_config { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EncryptionAtRestType { + Invalid, + MicrosoftManaged, + CustomerManaged, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastUpdateStatus { + Invalid, + NotEnabled, + PartiallySucceeded, + PartiallyFailed, + Failed, + Succeeded, + Initialized, + FirstInitialization, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InfrastructureEncryptionState { + Invalid, + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceEncryptionConfigExtended { + #[serde(flatten)] + pub backup_resource_encryption_config: BackupResourceEncryptionConfig, + #[serde(rename = "userAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identity: Option, + #[serde(rename = "useSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub use_system_assigned_identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceEncryptionConfigExtendedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceEncryptionConfigResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceVaultConfig { + #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] + pub storage_model_type: Option, + #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] + pub storage_type: Option, + #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] + pub storage_type_state: Option, + #[serde(rename = "enhancedSecurityState", default, skip_serializing_if = "Option::is_none")] + pub enhanced_security_state: Option, + #[serde(rename = "softDeleteFeatureState", default, skip_serializing_if = "Option::is_none")] + pub soft_delete_feature_state: Option, + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, + #[serde(rename = "isSoftDeleteFeatureStateEditable", default, skip_serializing_if = "Option::is_none")] + pub is_soft_delete_feature_state_editable: Option, +} +pub mod backup_resource_vault_config { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageModelType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageTypeState { + Invalid, + Locked, + Unlocked, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnhancedSecurityState { + Invalid, + Enabled, + Disabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SoftDeleteFeatureState { + Invalid, + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceVaultConfigResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupStatusRequest { + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] + pub po_logical_name: Option, +} +pub mod backup_status_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupStatusResponse { + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] + pub vault_id: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] + pub registration_status: Option, +} +pub mod backup_status_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionStatus { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FabricName { + Invalid, + Azure, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForLogSpecification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForProperties { + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryForServiceSpecification { + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientDiscoveryValueForSingleApi { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientScriptForConnect { + #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] + pub script_content: Option, + #[serde(rename = "scriptExtension", default, skip_serializing_if = "Option::is_none")] + pub script_extension: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "scriptNameSuffix", default, skip_serializing_if = "Option::is_none")] + pub script_name_suffix: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerIdentityInfo { + #[serde(rename = "uniqueName", default, skip_serializing_if = "Option::is_none")] + pub unique_name: Option, + #[serde(rename = "aadTenantId", default, skip_serializing_if = "Option::is_none")] + pub aad_tenant_id: Option, + #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmContainerExtendedInfo { + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod dpm_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmProtectedItemExtendedInfo { + #[serde(rename = "protectableObjectLoadPath", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_load_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protected: Option, + #[serde(rename = "isPresentOnCloud", default, skip_serializing_if = "Option::is_none")] + pub is_present_on_cloud: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "onPremiseOldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub on_premise_oldest_recovery_point: Option, + #[serde(rename = "onPremiseLatestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub on_premise_latest_recovery_point: Option, + #[serde(rename = "onPremiseRecoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub on_premise_recovery_point_count: Option, + #[serde(rename = "isCollocated", default, skip_serializing_if = "Option::is_none")] + pub is_collocated: Option, + #[serde(rename = "protectionGroupName", default, skip_serializing_if = "Option::is_none")] + pub protection_group_name: Option, + #[serde(rename = "diskStorageUsedInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_storage_used_in_bytes: Option, + #[serde(rename = "totalDiskStorageSizeInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_disk_storage_size_in_bytes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DailyRetentionFormat { + #[serde(rename = "daysOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_month: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DailyRetentionSchedule { + #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_times: Vec, + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Day { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub date: Option, + #[serde(rename = "isLast", default, skip_serializing_if = "Option::is_none")] + pub is_last: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskExclusionProperties { + #[serde(rename = "diskLunList", default, skip_serializing_if = "Vec::is_empty")] + pub disk_lun_list: Vec, + #[serde(rename = "isInclusionList", default, skip_serializing_if = "Option::is_none")] + pub is_inclusion_list: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskInformation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DistributedNodesInfo { + #[serde(rename = "nodeName", default, skip_serializing_if = "Option::is_none")] + pub node_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] + pub error_detail: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmBackupEngine { + #[serde(flatten)] + pub backup_engine_base: BackupEngineBase, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] + pub can_re_register: Option, + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[serde(rename = "dpmAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub dpm_agent_version: Option, + #[serde(rename = "dpmServers", default, skip_serializing_if = "Vec::is_empty")] + pub dpm_servers: Vec, + #[serde(rename = "upgradeAvailable", default, skip_serializing_if = "Option::is_none")] + pub upgrade_available: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmErrorInfo { + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "dpmServerName", default, skip_serializing_if = "Option::is_none")] + pub dpm_server_name: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionDetails { + #[serde(rename = "encryptionEnabled", default, skip_serializing_if = "Option::is_none")] + pub encryption_enabled: Option, + #[serde(rename = "kekUrl", default, skip_serializing_if = "Option::is_none")] + pub kek_url: Option, + #[serde(rename = "secretKeyUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_key_url: Option, + #[serde(rename = "kekVaultId", default, skip_serializing_if = "Option::is_none")] + pub kek_vault_id: Option, + #[serde(rename = "secretKeyVaultId", default, skip_serializing_if = "Option::is_none")] + pub secret_key_vault_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportJobsOperationResultInfo { + #[serde(flatten)] + pub operation_result_info_base: OperationResultInfoBase, + #[serde(rename = "blobUrl", default, skip_serializing_if = "Option::is_none")] + pub blob_url: Option, + #[serde(rename = "blobSasKey", default, skip_serializing_if = "Option::is_none")] + pub blob_sas_key: Option, + #[serde(rename = "excelFileBlobUrl", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_url: Option, + #[serde(rename = "excelFileBlobSasKey", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_sas_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedProperties { + #[serde(rename = "diskExclusionProperties", default, skip_serializing_if = "Option::is_none")] + pub disk_exclusion_properties: Option, + #[serde(rename = "linuxVmApplicationName", default, skip_serializing_if = "Option::is_none")] + pub linux_vm_application_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureSupportRequest { + #[serde(rename = "featureType")] + pub feature_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "extendedInformation", default, skip_serializing_if = "Option::is_none")] + pub extended_information: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericContainerExtendedInfo { + #[serde(rename = "rawCertData", default, skip_serializing_if = "Option::is_none")] + pub raw_cert_data: Option, + #[serde(rename = "containerIdentityInfo", default, skip_serializing_if = "Option::is_none")] + pub container_identity_info: Option, + #[serde(rename = "serviceEndpoints", default, skip_serializing_if = "Option::is_none")] + pub service_endpoints: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "protectedItemId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_id: Option, + #[serde(rename = "sourceAssociations", default, skip_serializing_if = "Option::is_none")] + pub source_associations: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, +} +pub mod generic_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[serde(rename = "subProtectionPolicy", default, skip_serializing_if = "Vec::is_empty")] + pub sub_protection_policy: Vec, + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_additional_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetProtectedItemQueryObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expand: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HourlySchedule { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub interval: Option, + #[serde(rename = "scheduleWindowStartTime", default, skip_serializing_if = "Option::is_none")] + pub schedule_window_start_time: Option, + #[serde(rename = "scheduleWindowDuration", default, skip_serializing_if = "Option::is_none")] + pub schedule_window_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IlrRequest { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IlrRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaaSvmContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaaSvmProtectableItem { + #[serde(flatten)] + pub workload_protectable_item: WorkloadProtectableItem, + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmBackupRequest { + #[serde(flatten)] + pub backup_request: BackupRequest, + #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_expiry_time_in_utc: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmilrRegistrationRequest { + #[serde(flatten)] + pub ilr_request: IlrRequest, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[serde(rename = "initiatorName", default, skip_serializing_if = "Option::is_none")] + pub initiator_name: Option, + #[serde(rename = "renewExistingRegistration", default, skip_serializing_if = "Option::is_none")] + pub renew_existing_registration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_additional_info: Option, + #[serde(rename = "sourceVMStorageType", default, skip_serializing_if = "Option::is_none")] + pub source_vm_storage_type: Option, + #[serde(rename = "isSourceVMEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_source_vm_encrypted: Option, + #[serde(rename = "keyAndSecret", default, skip_serializing_if = "Option::is_none")] + pub key_and_secret: Option, + #[serde(rename = "isInstantIlrSessionActive", default, skip_serializing_if = "Option::is_none")] + pub is_instant_ilr_session_active: Option, + #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_tier_details: Vec, + #[serde(rename = "isManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] + pub is_managed_virtual_machine: Option, + #[serde(rename = "virtualMachineSize", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_size: Option, + #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] + pub original_storage_account_option: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "recoveryPointDiskConfiguration", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_disk_configuration: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "recoveryPointMoveReadinessInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_move_readiness_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_machine_id: Option, + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[serde(rename = "virtualNetworkId", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_id: Option, + #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] + pub subnet_id: Option, + #[serde(rename = "targetDomainNameId", default, skip_serializing_if = "Option::is_none")] + pub target_domain_name_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, + #[serde(rename = "affinityGroup", default, skip_serializing_if = "Option::is_none")] + pub affinity_group: Option, + #[serde(rename = "createNewCloudService", default, skip_serializing_if = "Option::is_none")] + pub create_new_cloud_service: Option, + #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] + pub original_storage_account_option: Option, + #[serde(rename = "encryptionDetails", default, skip_serializing_if = "Option::is_none")] + pub encryption_details: Option, + #[serde(rename = "restoreDiskLunList", default, skip_serializing_if = "Vec::is_empty")] + pub restore_disk_lun_list: Vec, + #[serde(rename = "restoreWithManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub restore_with_managed_disks: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "identityInfo", default, skip_serializing_if = "Option::is_none")] + pub identity_info: Option, + #[serde(rename = "identityBasedRestoreDetails", default, skip_serializing_if = "Option::is_none")] + pub identity_based_restore_details: Option, +} +pub mod iaas_vm_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRestoreWithRehydrationRequest { + #[serde(flatten)] + pub iaas_vm_restore_request: IaasVmRestoreRequest, + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityBasedRestoreDetails { + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityInfo { + #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub is_system_assigned_identity: Option, + #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] + pub managed_identity_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InquiryInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] + pub error_detail: Option, + #[serde(rename = "inquiryDetails", default, skip_serializing_if = "Vec::is_empty")] + pub inquiry_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InquiryValidation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] + pub error_detail: Option, + #[serde(rename = "additionalDetail", default, skip_serializing_if = "Option::is_none")] + pub additional_detail: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InstantItemRecoveryTarget { + #[serde(rename = "clientScripts", default, skip_serializing_if = "Vec::is_empty")] + pub client_scripts: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InstantRpAdditionalDetails { + #[serde(rename = "azureBackupRGNamePrefix", default, skip_serializing_if = "Option::is_none")] + pub azure_backup_rg_name_prefix: Option, + #[serde(rename = "azureBackupRGNameSuffix", default, skip_serializing_if = "Option::is_none")] + pub azure_backup_rg_name_suffix: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Job { + #[serde(rename = "entityFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub entity_friendly_name: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, + #[serde(rename = "jobType")] + pub job_type: String, +} +pub mod job { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobQueryObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +pub mod job_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + InProgress, + Completed, + Failed, + CompletedWithWarnings, + Cancelled, + Cancelling, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operation { + Invalid, + Register, + UnRegister, + ConfigureBackup, + Backup, + Restore, + DisableBackup, + DeleteBackupData, + CrossRegionRestore, + Undelete, + UpdateCustomerManagedKey, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KekDetails { + #[serde(rename = "keyUrl", default, skip_serializing_if = "Option::is_none")] + pub key_url: Option, + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, + #[serde(rename = "keyBackupData", default, skip_serializing_if = "Option::is_none")] + pub key_backup_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KpiResourceHealthDetails { + #[serde(rename = "resourceHealthStatus", default, skip_serializing_if = "Option::is_none")] + pub resource_health_status: Option, + #[serde(rename = "resourceHealthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub resource_health_details: Vec, +} +pub mod kpi_resource_health_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceHealthStatus { + Healthy, + TransientDegraded, + PersistentDegraded, + TransientUnhealthy, + PersistentUnhealthy, + Invalid, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyAndSecretDetails { + #[serde(rename = "kekDetails", default, skip_serializing_if = "Option::is_none")] + pub kek_details: Option, + #[serde(rename = "bekDetails", default, skip_serializing_if = "Option::is_none")] + pub bek_details: Option, + #[serde(rename = "encryptionMechanism", default, skip_serializing_if = "Option::is_none")] + pub encryption_mechanism: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListRecoveryPointsRecommendedForMoveRequest { + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[serde(rename = "excludedRPList", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_rp_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogSchedulePolicy { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, + #[serde(rename = "scheduleFrequencyInMins", default, skip_serializing_if = "Option::is_none")] + pub schedule_frequency_in_mins: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LongTermRetentionPolicy { + #[serde(flatten)] + pub retention_policy: RetentionPolicy, + #[serde(rename = "dailySchedule", default, skip_serializing_if = "Option::is_none")] + pub daily_schedule: Option, + #[serde(rename = "weeklySchedule", default, skip_serializing_if = "Option::is_none")] + pub weekly_schedule: Option, + #[serde(rename = "monthlySchedule", default, skip_serializing_if = "Option::is_none")] + pub monthly_schedule: Option, + #[serde(rename = "yearlySchedule", default, skip_serializing_if = "Option::is_none")] + pub yearly_schedule: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LongTermSchedulePolicy { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabContainerHealthDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] + pub can_re_register: Option, + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "mabContainerHealthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub mab_container_health_details: Vec, + #[serde(rename = "containerHealthState", default, skip_serializing_if = "Option::is_none")] + pub container_health_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabContainerExtendedInfo { + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[serde(rename = "backupItemType", default, skip_serializing_if = "Option::is_none")] + pub backup_item_type: Option, + #[serde(rename = "backupItems", default, skip_serializing_if = "Vec::is_empty")] + pub backup_items: Vec, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, +} +pub mod mab_container_extended_info { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupItemType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabErrorInfo { + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabFileFolderProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "deferredDeleteSyncTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_sync_time_in_utc: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabFileFolderProtectedItemExtendedInfo { + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "mabServerName", default, skip_serializing_if = "Option::is_none")] + pub mab_server_name: Option, + #[serde(rename = "mabServerType", default, skip_serializing_if = "Option::is_none")] + pub mab_server_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod mab_job { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MabServerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] + pub schedule_policy: Option, + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonthlyRetentionSchedule { + #[serde(rename = "retentionScheduleFormatType", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_format_type: Option, + #[serde(rename = "retentionScheduleDaily", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_daily: Option, + #[serde(rename = "retentionScheduleWeekly", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_weekly: Option, + #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_times: Vec, + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +pub mod monthly_retention_schedule { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RetentionScheduleFormatType { + Invalid, + Daily, + Weekly, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveRpAcrossTiersRequest { + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[serde(rename = "sourceTierType", default, skip_serializing_if = "Option::is_none")] + pub source_tier_type: Option, + #[serde(rename = "targetTierType", default, skip_serializing_if = "Option::is_none")] + pub target_tier_type: Option, +} +pub mod move_rp_across_tiers_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceTierType { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TargetTierType { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NameInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NewErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod new_error_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Error { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResultInfo { + #[serde(flatten)] + pub operation_result_info_base: OperationResultInfoBase, + #[serde(rename = "jobList", default, skip_serializing_if = "Vec::is_empty")] + pub job_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResultInfoBase { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResultInfoBaseResource { + #[serde(flatten)] + pub operation_worker_response: OperationWorkerResponse, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod operation_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + InProgress, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusExtendedInfo { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusJobExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusJobsExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "jobIds", default, skip_serializing_if = "Vec::is_empty")] + pub job_ids: Vec, + #[serde(rename = "failedJobsError", default, skip_serializing_if = "Option::is_none")] + pub failed_jobs_error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusProvisionIlrExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "recoveryTarget", default, skip_serializing_if = "Option::is_none")] + pub recovery_target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusValidateOperationExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "validateOperationResponse", default, skip_serializing_if = "Option::is_none")] + pub validate_operation_response: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationWorkerResponse { + #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] + pub status_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, +} +pub mod operation_worker_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StatusCode { + Continue, + SwitchingProtocols, + #[serde(rename = "OK")] + Ok, + Created, + Accepted, + NonAuthoritativeInformation, + NoContent, + ResetContent, + PartialContent, + MultipleChoices, + Ambiguous, + MovedPermanently, + Moved, + Found, + Redirect, + SeeOther, + RedirectMethod, + NotModified, + UseProxy, + Unused, + TemporaryRedirect, + RedirectKeepVerb, + BadRequest, + Unauthorized, + PaymentRequired, + Forbidden, + NotFound, + MethodNotAllowed, + NotAcceptable, + ProxyAuthenticationRequired, + RequestTimeout, + Conflict, + Gone, + LengthRequired, + PreconditionFailed, + RequestEntityTooLarge, + RequestUriTooLong, + UnsupportedMediaType, + RequestedRangeNotSatisfiable, + ExpectationFailed, + UpgradeRequired, + InternalServerError, + NotImplemented, + BadGateway, + ServiceUnavailable, + GatewayTimeout, + HttpVersionNotSupported, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PointInTimeRange { + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PreBackupValidation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +pub mod pre_backup_validation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Success, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PreValidateEnableBackupRequest { + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] + pub vault_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod pre_validate_enable_backup_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PreValidateEnableBackupResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recommendation: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, +} +pub mod pre_validate_enable_backup_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Succeeded, + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrepareDataMoveRequest { + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, + #[serde(rename = "targetRegion")] + pub target_region: String, + #[serde(rename = "dataMoveLevel")] + pub data_move_level: prepare_data_move_request::DataMoveLevel, + #[serde(rename = "sourceContainerArmIds", default, skip_serializing_if = "Vec::is_empty")] + pub source_container_arm_ids: Vec, + #[serde(rename = "ignoreMoved", default, skip_serializing_if = "Option::is_none")] + pub ignore_moved: Option, +} +pub mod prepare_data_move_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataMoveLevel { + Invalid, + Vault, + Container, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrepareDataMoveResponse { + #[serde(flatten)] + pub vault_storage_config_operation_result_response: VaultStorageConfigOperationResultResponse, + #[serde(rename = "correlationId", default, skip_serializing_if = "Option::is_none")] + pub correlation_id: Option, + #[serde(rename = "sourceVaultProperties", default, skip_serializing_if = "Option::is_none")] + pub source_vault_properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, +} +pub mod private_endpoint_connection { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Deleting, + Failed, + Pending, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "actionRequired", default, skip_serializing_if = "Option::is_none")] + pub action_required: Option, +} +pub mod private_link_service_connection_state { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectableContainer { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "protectableContainerType")] + pub protectable_container_type: protectable_container::ProtectableContainerType, + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, +} +pub mod protectable_container { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectableContainerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectableContainerResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectableContainerResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItem { + #[serde(rename = "protectedItemType")] + pub protected_item_type: String, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "lastRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point: Option, + #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] + pub backup_set_name: Option, + #[serde(rename = "createMode", default, skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[serde(rename = "deferredDeleteTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_time_in_utc: Option, + #[serde(rename = "isScheduledForDeferredDelete", default, skip_serializing_if = "Option::is_none")] + pub is_scheduled_for_deferred_delete: Option, + #[serde(rename = "deferredDeleteTimeRemaining", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_time_remaining: Option, + #[serde(rename = "isDeferredDeleteScheduleUpcoming", default, skip_serializing_if = "Option::is_none")] + pub is_deferred_delete_schedule_upcoming: Option, + #[serde(rename = "isRehydrate", default, skip_serializing_if = "Option::is_none")] + pub is_rehydrate: Option, + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, + #[serde(rename = "isArchiveEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_archive_enabled: Option, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, +} +pub mod protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreateMode { + Invalid, + Default, + Recover, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemQueryObject { + #[serde(rename = "healthState", default, skip_serializing_if = "Option::is_none")] + pub health_state: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] + pub item_type: Option, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] + pub backup_set_name: Option, +} +pub mod protected_item_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthState { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ItemType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainer { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] + pub registration_status: Option, + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[serde(rename = "containerType")] + pub container_type: protection_container::ContainerType, + #[serde(rename = "protectableObjectType", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_type: Option, +} +pub mod protection_container { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ContainerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionIntent { + #[serde(rename = "protectionIntentItemType")] + pub protection_intent_item_type: protection_intent::ProtectionIntentItemType, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "itemId", default, skip_serializing_if = "Option::is_none")] + pub item_id: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, +} +pub mod protection_intent { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionIntentItemType { + Invalid, + AzureResourceItem, + RecoveryServiceVaultItem, + AzureWorkloadContainerAutoProtectionIntent, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionIntentQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] + pub item_type: Option, + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[serde(rename = "itemName", default, skip_serializing_if = "Option::is_none")] + pub item_name: Option, +} +pub mod protection_intent_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ItemType { + Invalid, + #[serde(rename = "SQLInstance")] + SqlInstance, + #[serde(rename = "SQLAvailabilityGroupContainer")] + SqlAvailabilityGroupContainer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionIntentResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionIntentResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionPolicy { + #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] + pub protected_items_count: Option, + #[serde(rename = "backupManagementType")] + pub backup_management_type: String, + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionPolicyQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, +} +pub mod protection_policy_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionPolicyResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionPolicyResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPoint { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointDiskConfiguration { + #[serde(rename = "numberOfDisksIncludedInBackup", default, skip_serializing_if = "Option::is_none")] + pub number_of_disks_included_in_backup: Option, + #[serde(rename = "numberOfDisksAttachedToVm", default, skip_serializing_if = "Option::is_none")] + pub number_of_disks_attached_to_vm: Option, + #[serde(rename = "includedDiskList", default, skip_serializing_if = "Vec::is_empty")] + pub included_disk_list: Vec, + #[serde(rename = "excludedDiskList", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_disk_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointMoveReadinessInfo { + #[serde(rename = "isReadyForMove", default, skip_serializing_if = "Option::is_none")] + pub is_ready_for_move: Option, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Option::is_none")] + pub additional_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointRehydrationInfo { + #[serde(rename = "rehydrationRetentionDuration", default, skip_serializing_if = "Option::is_none")] + pub rehydration_retention_duration: Option, + #[serde(rename = "rehydrationPriority", default, skip_serializing_if = "Option::is_none")] + pub rehydration_priority: Option, +} +pub mod recovery_point_rehydration_info { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RehydrationPriority { + Standard, + High, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointTierInformation { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod recovery_point_tier_information { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Valid, + Disabled, + Deleted, + Rehydrated, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointTierInformationV2 { + #[serde(flatten)] + pub recovery_point_tier_information: RecoveryPointTierInformation, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod recovery_point_tier_information_v2 { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Valid, + Disabled, + Deleted, + Rehydrated, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGuardOperationDetail { + #[serde(rename = "vaultCriticalOperation", default, skip_serializing_if = "Option::is_none")] + pub vault_critical_operation: Option, + #[serde(rename = "defaultResourceRequest", default, skip_serializing_if = "Option::is_none")] + pub default_resource_request: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGuardProxyBase { + #[serde(rename = "resourceGuardResourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_guard_resource_id: Option, + #[serde(rename = "resourceGuardOperationDetails", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_details: Vec, + #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGuardProxyBaseResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGuardProxyBaseResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceHealthDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreFileSpecs { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "fileSpecType", default, skip_serializing_if = "Option::is_none")] + pub file_spec_type: Option, + #[serde(rename = "targetFolderPath", default, skip_serializing_if = "Option::is_none")] + pub target_folder_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreRequest { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionDuration { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(rename = "durationType", default, skip_serializing_if = "Option::is_none")] + pub duration_type: Option, +} +pub mod retention_duration { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DurationType { + Invalid, + Days, + Weeks, + Months, + Years, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionPolicy { + #[serde(rename = "retentionPolicyType")] + pub retention_policy_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDataDirectory { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "logicalName", default, skip_serializing_if = "Option::is_none")] + pub logical_name: Option, +} +pub mod sql_data_directory { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Data, + Log, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDataDirectoryMapping { + #[serde(rename = "mappingType", default, skip_serializing_if = "Option::is_none")] + pub mapping_type: Option, + #[serde(rename = "sourceLogicalName", default, skip_serializing_if = "Option::is_none")] + pub source_logical_name: Option, + #[serde(rename = "sourcePath", default, skip_serializing_if = "Option::is_none")] + pub source_path: Option, + #[serde(rename = "targetPath", default, skip_serializing_if = "Option::is_none")] + pub target_path: Option, +} +pub mod sql_data_directory_mapping { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MappingType { + Invalid, + Data, + Log, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SchedulePolicy { + #[serde(rename = "schedulePolicyType")] + pub schedule_policy_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityPinBase { + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Settings { + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub issqlcompression: Option, + #[serde(rename = "isCompression", default, skip_serializing_if = "Option::is_none")] + pub is_compression: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimpleRetentionPolicy { + #[serde(flatten)] + pub retention_policy: RetentionPolicy, + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimpleSchedulePolicy { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, + #[serde(rename = "scheduleRunFrequency", default, skip_serializing_if = "Option::is_none")] + pub schedule_run_frequency: Option, + #[serde(rename = "scheduleRunDays", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_run_days: Vec, + #[serde(rename = "scheduleRunTimes", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_run_times: Vec, + #[serde(rename = "hourlySchedule", default, skip_serializing_if = "Option::is_none")] + pub hourly_schedule: Option, + #[serde(rename = "scheduleWeeklyFrequency", default, skip_serializing_if = "Option::is_none")] + pub schedule_weekly_frequency: Option, +} +pub mod simple_schedule_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScheduleRunFrequency { + Invalid, + Daily, + Weekly, + Hourly, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubProtectionPolicy { + #[serde(rename = "policyType", default, skip_serializing_if = "Option::is_none")] + pub policy_type: Option, + #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] + pub schedule_policy: Option, + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, +} +pub mod sub_protection_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PolicyType { + Invalid, + Full, + Differential, + Log, + CopyOnlyFull, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetAfsRestoreInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetRestoreInfo { + #[serde(rename = "overwriteOption", default, skip_serializing_if = "Option::is_none")] + pub overwrite_option: Option, + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(rename = "targetDirectoryForFileRestore", default, skip_serializing_if = "Option::is_none")] + pub target_directory_for_file_restore: Option, +} +pub mod target_restore_info { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OverwriteOption { + Invalid, + FailOnConflict, + Overwrite, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TokenInformation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub token: Option, + #[serde(rename = "expiryTimeInUtcTicks", default, skip_serializing_if = "Option::is_none")] + pub expiry_time_in_utc_ticks: Option, + #[serde(rename = "securityPIN", default, skip_serializing_if = "Option::is_none")] + pub security_pin: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerDataMoveRequest { + #[serde(rename = "sourceResourceId")] + pub source_resource_id: String, + #[serde(rename = "sourceRegion")] + pub source_region: String, + #[serde(rename = "dataMoveLevel")] + pub data_move_level: trigger_data_move_request::DataMoveLevel, + #[serde(rename = "correlationId")] + pub correlation_id: String, + #[serde(rename = "sourceContainerArmIds", default, skip_serializing_if = "Vec::is_empty")] + pub source_container_arm_ids: Vec, + #[serde(rename = "pauseGC", default, skip_serializing_if = "Option::is_none")] + pub pause_gc: Option, +} +pub mod trigger_data_move_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataMoveLevel { + Invalid, + Vault, + Container, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnlockDeleteRequest { + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, + #[serde(rename = "resourceToBeDeleted", default, skip_serializing_if = "Option::is_none")] + pub resource_to_be_deleted: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnlockDeleteResponse { + #[serde(rename = "unlockDeleteExpiryTime", default, skip_serializing_if = "Option::is_none")] + pub unlock_delete_expiry_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateIaasVmRestoreOperationRequest { + #[serde(flatten)] + pub validate_restore_operation_request: ValidateRestoreOperationRequest, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateOperationRequest { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateOperationResponse { + #[serde(rename = "validationResults", default, skip_serializing_if = "Vec::is_empty")] + pub validation_results: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateOperationsResponse { + #[serde(rename = "validateOperationResponse", default, skip_serializing_if = "Option::is_none")] + pub validate_operation_response: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateRestoreOperationRequest { + #[serde(flatten)] + pub validate_operation_request: ValidateOperationRequest, + #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] + pub restore_request: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultJobErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultJobExtendedInfo { + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultStorageConfigOperationResultResponse { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WeeklyRetentionFormat { + #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_week: Vec, + #[serde(rename = "weeksOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] + pub weeks_of_the_month: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WeeklyRetentionSchedule { + #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_week: Vec, + #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_times: Vec, + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadInquiryDetails { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "itemCount", default, skip_serializing_if = "Option::is_none")] + pub item_count: Option, + #[serde(rename = "inquiryValidation", default, skip_serializing_if = "Option::is_none")] + pub inquiry_validation: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadItem { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "workloadItemType")] + pub workload_item_type: String, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, +} +pub mod workload_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadItemResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadItemResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadProtectableItem { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "protectableItemType")] + pub protectable_item_type: String, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, +} +pub mod workload_protectable_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadProtectableItemResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadProtectableItemResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct YearlyRetentionSchedule { + #[serde(rename = "retentionScheduleFormatType", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_format_type: Option, + #[serde(rename = "monthsOfYear", default, skip_serializing_if = "Vec::is_empty")] + pub months_of_year: Vec, + #[serde(rename = "retentionScheduleDaily", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_daily: Option, + #[serde(rename = "retentionScheduleWeekly", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_weekly: Option, + #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_times: Vec, + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +pub mod yearly_retention_schedule { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RetentionScheduleFormatType { + Invalid, + Daily, + Weekly, + } +} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2021_10/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2021_10/operations.rs new file mode 100644 index 0000000000..15dfd39d2c --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_2021_10/operations.rs @@ -0,0 +1,7832 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn backup_engines(&self) -> backup_engines::Client { + backup_engines::Client(self.clone()) + } + pub fn backup_jobs(&self) -> backup_jobs::Client { + backup_jobs::Client(self.clone()) + } + pub fn backup_operation_results(&self) -> backup_operation_results::Client { + backup_operation_results::Client(self.clone()) + } + pub fn backup_operation_statuses(&self) -> backup_operation_statuses::Client { + backup_operation_statuses::Client(self.clone()) + } + pub fn backup_policies(&self) -> backup_policies::Client { + backup_policies::Client(self.clone()) + } + pub fn backup_protectable_items(&self) -> backup_protectable_items::Client { + backup_protectable_items::Client(self.clone()) + } + pub fn backup_protected_items(&self) -> backup_protected_items::Client { + backup_protected_items::Client(self.clone()) + } + pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { + backup_protection_containers::Client(self.clone()) + } + pub fn backup_protection_intent(&self) -> backup_protection_intent::Client { + backup_protection_intent::Client(self.clone()) + } + pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { + backup_resource_encryption_configs::Client(self.clone()) + } + pub fn backup_resource_storage_configs_non_crr(&self) -> backup_resource_storage_configs_non_crr::Client { + backup_resource_storage_configs_non_crr::Client(self.clone()) + } + pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { + backup_resource_vault_configs::Client(self.clone()) + } + pub fn backup_status(&self) -> backup_status::Client { + backup_status::Client(self.clone()) + } + pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { + backup_usage_summaries::Client(self.clone()) + } + pub fn backup_workload_items(&self) -> backup_workload_items::Client { + backup_workload_items::Client(self.clone()) + } + pub fn backups(&self) -> backups::Client { + backups::Client(self.clone()) + } + pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { + bms_prepare_data_move_operation_result::Client(self.clone()) + } + pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { + export_jobs_operation_results::Client(self.clone()) + } + pub fn feature_support(&self) -> feature_support::Client { + feature_support::Client(self.clone()) + } + pub fn item_level_recovery_connections(&self) -> item_level_recovery_connections::Client { + item_level_recovery_connections::Client(self.clone()) + } + pub fn job_cancellations(&self) -> job_cancellations::Client { + job_cancellations::Client(self.clone()) + } + pub fn job_details(&self) -> job_details::Client { + job_details::Client(self.clone()) + } + pub fn job_operation_results(&self) -> job_operation_results::Client { + job_operation_results::Client(self.clone()) + } + pub fn jobs(&self) -> jobs::Client { + jobs::Client(self.clone()) + } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint(&self) -> private_endpoint::Client { + private_endpoint::Client(self.clone()) + } + pub fn private_endpoint_connection(&self) -> private_endpoint_connection::Client { + private_endpoint_connection::Client(self.clone()) + } + pub fn protectable_containers(&self) -> protectable_containers::Client { + protectable_containers::Client(self.clone()) + } + pub fn protected_item_operation_results(&self) -> protected_item_operation_results::Client { + protected_item_operation_results::Client(self.clone()) + } + pub fn protected_item_operation_statuses(&self) -> protected_item_operation_statuses::Client { + protected_item_operation_statuses::Client(self.clone()) + } + pub fn protected_items(&self) -> protected_items::Client { + protected_items::Client(self.clone()) + } + pub fn protection_container_operation_results(&self) -> protection_container_operation_results::Client { + protection_container_operation_results::Client(self.clone()) + } + pub fn protection_container_refresh_operation_results(&self) -> protection_container_refresh_operation_results::Client { + protection_container_refresh_operation_results::Client(self.clone()) + } + pub fn protection_containers(&self) -> protection_containers::Client { + protection_containers::Client(self.clone()) + } + pub fn protection_intent(&self) -> protection_intent::Client { + protection_intent::Client(self.clone()) + } + pub fn protection_policies(&self) -> protection_policies::Client { + protection_policies::Client(self.clone()) + } + pub fn protection_policy_operation_results(&self) -> protection_policy_operation_results::Client { + protection_policy_operation_results::Client(self.clone()) + } + pub fn protection_policy_operation_statuses(&self) -> protection_policy_operation_statuses::Client { + protection_policy_operation_statuses::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { + recovery_points_recommended_for_move::Client(self.clone()) + } + pub fn resource_guard_proxies(&self) -> resource_guard_proxies::Client { + resource_guard_proxies::Client(self.clone()) + } + pub fn resource_guard_proxy(&self) -> resource_guard_proxy::Client { + resource_guard_proxy::Client(self.clone()) + } + pub fn restores(&self) -> restores::Client { + restores::Client(self.clone()) + } + pub fn security_pi_ns(&self) -> security_pi_ns::Client { + security_pi_ns::Client(self.clone()) + } + pub fn validate_operation(&self) -> validate_operation::Client { + validate_operation::Client(self.clone()) + } + pub fn validate_operation_results(&self) -> validate_operation_results::Client { + validate_operation_results::Client(self.clone()) + } + pub fn validate_operation_statuses(&self) -> validate_operation_statuses::Client { + validate_operation_statuses::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + BackupResourceStorageConfigsNonCrr_Get(#[from] backup_resource_storage_configs_non_crr::get::Error), + #[error(transparent)] + BackupResourceStorageConfigsNonCrr_Update(#[from] backup_resource_storage_configs_non_crr::update::Error), + #[error(transparent)] + BackupResourceStorageConfigsNonCrr_Patch(#[from] backup_resource_storage_configs_non_crr::patch::Error), + #[error(transparent)] + ProtectionIntent_Validate(#[from] protection_intent::validate::Error), + #[error(transparent)] + BackupStatus_Get(#[from] backup_status::get::Error), + #[error(transparent)] + FeatureSupport_Validate(#[from] feature_support::validate::Error), + #[error(transparent)] + ProtectionIntent_Get(#[from] protection_intent::get::Error), + #[error(transparent)] + ProtectionIntent_CreateOrUpdate(#[from] protection_intent::create_or_update::Error), + #[error(transparent)] + ProtectionIntent_Delete(#[from] protection_intent::delete::Error), + #[error(transparent)] + BackupProtectionIntent_List(#[from] backup_protection_intent::list::Error), + #[error(transparent)] + BackupUsageSummaries_List(#[from] backup_usage_summaries::list::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + BackupResourceVaultConfigs_Get(#[from] backup_resource_vault_configs::get::Error), + #[error(transparent)] + BackupResourceVaultConfigs_Put(#[from] backup_resource_vault_configs::put::Error), + #[error(transparent)] + BackupResourceVaultConfigs_Update(#[from] backup_resource_vault_configs::update::Error), + #[error(transparent)] + BackupResourceEncryptionConfigs_Get(#[from] backup_resource_encryption_configs::get::Error), + #[error(transparent)] + BackupResourceEncryptionConfigs_Update(#[from] backup_resource_encryption_configs::update::Error), + #[error(transparent)] + PrivateEndpointConnection_Get(#[from] private_endpoint_connection::get::Error), + #[error(transparent)] + PrivateEndpointConnection_Put(#[from] private_endpoint_connection::put::Error), + #[error(transparent)] + PrivateEndpointConnection_Delete(#[from] private_endpoint_connection::delete::Error), + #[error(transparent)] + PrivateEndpoint_GetOperationStatus(#[from] private_endpoint::get_operation_status::Error), + #[error(transparent)] + GetOperationStatus(#[from] get_operation_status::Error), + #[error(transparent)] + BmsPrepareDataMove(#[from] bms_prepare_data_move::Error), + #[error(transparent)] + BmsPrepareDataMoveOperationResult_Get(#[from] bms_prepare_data_move_operation_result::get::Error), + #[error(transparent)] + BmsTriggerDataMove(#[from] bms_trigger_data_move::Error), + #[error(transparent)] + ProtectedItems_Get(#[from] protected_items::get::Error), + #[error(transparent)] + ProtectedItems_CreateOrUpdate(#[from] protected_items::create_or_update::Error), + #[error(transparent)] + ProtectedItems_Delete(#[from] protected_items::delete::Error), + #[error(transparent)] + ProtectedItemOperationResults_Get(#[from] protected_item_operation_results::get::Error), + #[error(transparent)] + RecoveryPoints_List(#[from] recovery_points::list::Error), + #[error(transparent)] + RecoveryPoints_Get(#[from] recovery_points::get::Error), + #[error(transparent)] + Restores_Trigger(#[from] restores::trigger::Error), + #[error(transparent)] + BackupPolicies_List(#[from] backup_policies::list::Error), + #[error(transparent)] + ProtectionPolicies_Get(#[from] protection_policies::get::Error), + #[error(transparent)] + ProtectionPolicies_CreateOrUpdate(#[from] protection_policies::create_or_update::Error), + #[error(transparent)] + ProtectionPolicies_Delete(#[from] protection_policies::delete::Error), + #[error(transparent)] + ProtectionPolicyOperationResults_Get(#[from] protection_policy_operation_results::get::Error), + #[error(transparent)] + BackupJobs_List(#[from] backup_jobs::list::Error), + #[error(transparent)] + JobDetails_Get(#[from] job_details::get::Error), + #[error(transparent)] + JobCancellations_Trigger(#[from] job_cancellations::trigger::Error), + #[error(transparent)] + JobOperationResults_Get(#[from] job_operation_results::get::Error), + #[error(transparent)] + ExportJobsOperationResults_Get(#[from] export_jobs_operation_results::get::Error), + #[error(transparent)] + Jobs_Export(#[from] jobs::export::Error), + #[error(transparent)] + BackupProtectedItems_List(#[from] backup_protected_items::list::Error), + #[error(transparent)] + Operation_Validate(#[from] operation::validate::Error), + #[error(transparent)] + ValidateOperation_Trigger(#[from] validate_operation::trigger::Error), + #[error(transparent)] + ValidateOperationResults_Get(#[from] validate_operation_results::get::Error), + #[error(transparent)] + ValidateOperationStatuses_Get(#[from] validate_operation_statuses::get::Error), + #[error(transparent)] + BackupEngines_List(#[from] backup_engines::list::Error), + #[error(transparent)] + BackupEngines_Get(#[from] backup_engines::get::Error), + #[error(transparent)] + ProtectionContainerRefreshOperationResults_Get(#[from] protection_container_refresh_operation_results::get::Error), + #[error(transparent)] + ProtectableContainers_List(#[from] protectable_containers::list::Error), + #[error(transparent)] + ProtectionContainers_Get(#[from] protection_containers::get::Error), + #[error(transparent)] + ProtectionContainers_Register(#[from] protection_containers::register::Error), + #[error(transparent)] + ProtectionContainers_Unregister(#[from] protection_containers::unregister::Error), + #[error(transparent)] + ProtectionContainers_Inquire(#[from] protection_containers::inquire::Error), + #[error(transparent)] + BackupWorkloadItems_List(#[from] backup_workload_items::list::Error), + #[error(transparent)] + ProtectionContainerOperationResults_Get(#[from] protection_container_operation_results::get::Error), + #[error(transparent)] + Backups_Trigger(#[from] backups::trigger::Error), + #[error(transparent)] + ProtectedItemOperationStatuses_Get(#[from] protected_item_operation_statuses::get::Error), + #[error(transparent)] + ItemLevelRecoveryConnections_Provision(#[from] item_level_recovery_connections::provision::Error), + #[error(transparent)] + ItemLevelRecoveryConnections_Revoke(#[from] item_level_recovery_connections::revoke::Error), + #[error(transparent)] + ProtectionContainers_Refresh(#[from] protection_containers::refresh::Error), + #[error(transparent)] + BackupOperationResults_Get(#[from] backup_operation_results::get::Error), + #[error(transparent)] + BackupOperationStatuses_Get(#[from] backup_operation_statuses::get::Error), + #[error(transparent)] + ProtectionPolicyOperationStatuses_Get(#[from] protection_policy_operation_statuses::get::Error), + #[error(transparent)] + BackupProtectableItems_List(#[from] backup_protectable_items::list::Error), + #[error(transparent)] + BackupProtectionContainers_List(#[from] backup_protection_containers::list::Error), + #[error(transparent)] + SecurityPiNs_Get(#[from] security_pi_ns::get::Error), + #[error(transparent)] + MoveRecoveryPoint(#[from] move_recovery_point::Error), + #[error(transparent)] + RecoveryPointsRecommendedForMove_List(#[from] recovery_points_recommended_for_move::list::Error), + #[error(transparent)] + ResourceGuardProxies_Get(#[from] resource_guard_proxies::get::Error), + #[error(transparent)] + ResourceGuardProxy_Get(#[from] resource_guard_proxy::get::Error), + #[error(transparent)] + ResourceGuardProxy_Put(#[from] resource_guard_proxy::put::Error), + #[error(transparent)] + ResourceGuardProxy_Delete(#[from] resource_guard_proxy::delete::Error), + #[error(transparent)] + ResourceGuardProxy_UnlockDelete(#[from] resource_guard_proxy::unlock_delete::Error), +} +pub mod backup_resource_storage_configs_non_crr { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn patch( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceConfigResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceConfigResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_intent { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "It will validate followings\r\n1. Vault capacity\r\n2. VM is already protected\r\n3. Any VM related configuration passed in properties."] + pub fn validate( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + intent_object_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + intent_object_name: intent_object_name.into(), + } + } + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + intent_object_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + intent_object_name: intent_object_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + intent_object_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + intent_object_name: intent_object_name.into(), + } + } + } + pub mod validate { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::PreValidateEnableBackupRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupPreValidateProtection", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PreValidateEnableBackupResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) intent_object_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionIntentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) intent_object_name: String, + pub(crate) parameters: models::ProtectionIntentResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionIntentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) intent_object_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod backup_status { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the container backup status"] + pub fn get( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupStatusRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupStatus", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupStatusResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod feature_support { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "It will validate if given feature with resource properties is supported in service"] + pub fn validate( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod validate { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::FeatureSupportRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupValidateFeatures", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureVmResourceFeatureSupportResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod backup_protection_intent { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionIntents", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionIntentResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod backup_usage_summaries { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupManagementUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientDiscoveryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod backup_resource_vault_configs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn put( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceVaultConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceVaultConfigResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceVaultConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceVaultConfigResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceVaultConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_resource_encryption_configs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEncryptionConfigs/backupResourceEncryptionConfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceEncryptionConfigExtendedResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceEncryptionConfigResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEncryptionConfigs/backupResourceEncryptionConfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connection { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn put( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnectionResource), + Created201(models::PrivateEndpointConnectionResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnectionResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for a private endpoint connection."] + pub fn get_operation_status( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + operation_id: impl Into, + ) -> get_operation_status::Builder { + get_operation_status::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get_operation_status { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateEndpointConnections/{}/operationsStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . private_endpoint_connection_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn get_operation_status( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get_operation_status::Builder { + get_operation_status::Builder { + client: self.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + pub fn bms_prepare_data_move( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> bms_prepare_data_move::Builder { + bms_prepare_data_move::Builder { + client: self.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn bms_trigger_data_move( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> bms_trigger_data_move::Builder { + bms_trigger_data_move::Builder { + client: self.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + #[doc = "Move recovery point from one datastore to another store."] + pub fn move_recovery_point( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + parameters: impl Into, + ) -> move_recovery_point::Builder { + move_recovery_point::Builder { + client: self.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + parameters: parameters.into(), + } + } +} +pub mod get_operation_status { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig/operationStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod bms_prepare_data_move { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::PrepareDataMoveRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig/prepareDataMove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod bms_trigger_data_move { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::TriggerDataMoveRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig/triggerDataMove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod move_recovery_point { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + pub(crate) parameters: models::MoveRpAcrossTiersRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/move" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod bms_prepare_data_move_operation_result { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VaultStorageConfigOperationResultResponse), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultStorageConfigOperationResultResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protected_items { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + filter: None, + } + } + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectedItemResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) parameters: models::ProtectedItemResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protected_item_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectedItemResource), + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + filter: None, + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restores { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + parameters: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + parameters: parameters.into(), + } + } + } + pub mod trigger { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + pub(crate) parameters: models::RestoreRequestResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/restore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_policies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionPolicyResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_policies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + } + } + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionPolicyResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) parameters: models::ProtectionPolicyResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_policy_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_jobs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod job_details { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod job_cancellations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + } + pub mod trigger { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}/cancel", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod job_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . job_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod export_jobs_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationResultInfoBaseResource), + Accepted202(models::OperationResultInfoBaseResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResultInfoBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResultInfoBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod jobs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn export( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> export::Builder { + export::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod export { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobsExport", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_protected_items { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn validate( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod validate { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::ValidateOperationRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupValidateOperation", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateOperationsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod validate_operation { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod trigger { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::ValidateOperationRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupTriggerValidateOperation" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod validate_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ValidateOperationsResponse), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupValidateOperationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateOperationsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod validate_operation_statuses { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupValidateOperationsStatuses/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_engines { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_engine_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_engine_name: backup_engine_name.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupEngineBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_engine_name: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_engine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupEngineBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_container_refresh_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protectable_containers { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + filter: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectableContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectableContainerResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_containers { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + } + } + pub fn register( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + parameters: impl Into, + ) -> register::Builder { + register::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + parameters: parameters.into(), + } + } + pub fn unregister( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + ) -> unregister::Builder { + unregister::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + } + } + #[doc = "Inquires all the protectable items under the given container."] + pub fn inquire( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + ) -> inquire::Builder { + inquire::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + filter: None, + } + } + pub fn refresh( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> refresh::Builder { + refresh::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + filter: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod register { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainerResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) parameters: models::ProtectionContainerResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod unregister { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod inquire { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/inquire" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod refresh { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/refreshContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_workload_items { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/items" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkloadItemResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_container_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainerResource), + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backups { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + parameters: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + parameters: parameters.into(), + } + } + } + pub mod trigger { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) parameters: models::BackupRequestResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protected_item_operation_statuses { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationsStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod item_level_recovery_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn provision( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + parameters: impl Into, + ) -> provision::Builder { + provision::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + parameters: parameters.into(), + } + } + pub fn revoke( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + ) -> revoke::Builder { + revoke::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + } + } + } + pub mod provision { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + pub(crate) parameters: models::IlrRequestResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/provisionInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod revoke { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/revokeInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_operation_statuses { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_policy_operation_statuses { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_protectable_items { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectableItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkloadProtectableItemResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_protection_containers { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionContainers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod security_pi_ns { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupSecurityPIN", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TokenInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points_recommended_for_move { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + parameters: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) parameters: models::ListRecoveryPointsRecommendedForMoveRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPointsRecommendedForMove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_guard_proxies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardProxyBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_guard_proxy { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guard_proxy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guard_proxy_name: resource_guard_proxy_name.into(), + } + } + pub fn put( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guard_proxy_name: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guard_proxy_name: resource_guard_proxy_name.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guard_proxy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guard_proxy_name: resource_guard_proxy_name.into(), + } + } + pub fn unlock_delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guard_proxy_name: impl Into, + parameters: impl Into, + ) -> unlock_delete::Builder { + unlock_delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guard_proxy_name: resource_guard_proxy_name.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guard_proxy_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . resource_guard_proxy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardProxyBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guard_proxy_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . resource_guard_proxy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardProxyBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guard_proxy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . resource_guard_proxy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod unlock_delete { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guard_proxy_name: String, + pub(crate) parameters: models::UnlockDeleteRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies/{}/unlockDelete" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . resource_guard_proxy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UnlockDeleteResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/mod.rs b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/mod.rs new file mode 100644 index 0000000000..21e7e5b914 --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2018-12-20"; diff --git a/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/models.rs b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/models.rs new file mode 100644 index 0000000000..13094895e0 --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/models.rs @@ -0,0 +1,1909 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadProperties { + #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_client_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, + #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_object_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadPropertiesResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "fileShareSnapshotUri", default, skip_serializing_if = "Option::is_none")] + pub file_share_snapshot_uri: Option, + #[serde(rename = "recoveryPointSizeInGB", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_size_in_gb: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "copyOptions", default, skip_serializing_if = "Option::is_none")] + pub copy_options: Option, + #[serde(rename = "restoreRequestType", default, skip_serializing_if = "Option::is_none")] + pub restore_request_type: Option, + #[serde(rename = "restoreFileSpecs", default, skip_serializing_if = "Vec::is_empty")] + pub restore_file_specs: Vec, + #[serde(rename = "targetDetails", default, skip_serializing_if = "Option::is_none")] + pub target_details: Option, +} +pub mod azure_file_share_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CopyOptions { + Invalid, + CreateCopy, + Skip, + Overwrite, + FailOnConflict, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestoreRequestType { + Invalid, + FullShareRestore, + ItemLevelRestore, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileshareProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod azure_fileshare_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthStatus { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileshareProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[serde(rename = "resourceStateSyncTime", default, skip_serializing_if = "Option::is_none")] + pub resource_state_sync_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSClassicComputeVmProtectedItem { + #[serde(flatten)] + pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSComputeVmProtectedItem { + #[serde(flatten)] + pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] + pub error_title: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmHealthDetails { + #[serde(flatten)] + pub resource_health_details: ResourceHealthDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "internalPropertyBag", default, skip_serializing_if = "Option::is_none")] + pub internal_property_bag: Option, + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, + #[serde(rename = "estimatedRemainingDuration", default, skip_serializing_if = "Option::is_none")] + pub estimated_remaining_duration: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "instanceId", default, skip_serializing_if = "Option::is_none")] + pub instance_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, + #[serde(rename = "taskExecutionDetails", default, skip_serializing_if = "Option::is_none")] + pub task_execution_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[serde(rename = "healthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_details: Vec, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_id: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "extendedProperties", default, skip_serializing_if = "Option::is_none")] + pub extended_properties: Option, +} +pub mod azure_iaa_svm_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthStatus { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyInconsistent", default, skip_serializing_if = "Option::is_none")] + pub policy_inconsistent: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_id: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod azure_sql_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_name: Option, + #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] + pub storage_account_version: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] + pub server_name: Option, + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[serde(rename = "parentType", default, skip_serializing_if = "Option::is_none")] + pub parent_type: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "lastBackupErrorDetail", default, skip_serializing_if = "Option::is_none")] + pub last_backup_error_detail: Option, + #[serde(rename = "protectedItemDataSourceId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_source_id: Option, + #[serde(rename = "protectedItemHealthStatus", default, skip_serializing_if = "Option::is_none")] + pub protected_item_health_status: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, +} +pub mod azure_vm_workload_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastBackupStatus { + Invalid, + Healthy, + Unhealthy, + #[serde(rename = "IRPending")] + IrPending, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectedItemHealthStatus { + Invalid, + Healthy, + Unhealthy, + NotReachable, + #[serde(rename = "IRPending")] + IrPending, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] + pub error_title: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJob { + #[serde(flatten)] + pub job: Job, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, + #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub time_ranges: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time_in_utc: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_tier_details: Vec, + #[serde(rename = "recoveryPointMoveReadinessInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_move_readiness_info: Option, +} +pub mod azure_workload_recovery_point { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Full, + Log, + Differential, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "targetInfo", default, skip_serializing_if = "Option::is_none")] + pub target_info: Option, + #[serde(rename = "recoveryMode", default, skip_serializing_if = "Option::is_none")] + pub recovery_mode: Option, + #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_machine_id: Option, +} +pub mod azure_workload_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryMode { + Invalid, + FileRecovery, + WorkloadRecovery, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_point_in_time_recovery_point: AzureWorkloadPointInTimeRecoveryPoint, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, + #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub time_ranges: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRecoveryPointExtendedInfo { + #[serde(rename = "dataDirectoryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub data_directory_time_in_utc: Option, + #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub data_directory_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, + #[serde(rename = "shouldUseAlternateTargetLocation", default, skip_serializing_if = "Option::is_none")] + pub should_use_alternate_target_location: Option, + #[serde(rename = "isNonRecoverable", default, skip_serializing_if = "Option::is_none")] + pub is_non_recoverable: Option, + #[serde(rename = "alternateDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub alternate_directory_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BekDetails { + #[serde(rename = "secretUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_url: Option, + #[serde(rename = "secretVaultId", default, skip_serializing_if = "Option::is_none")] + pub secret_vault_id: Option, + #[serde(rename = "secretData", default, skip_serializing_if = "Option::is_none")] + pub secret_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsaadPropertiesQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, +} +pub mod bmsaad_properties_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsBackupSummariesQueryObject { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod bms_backup_summaries_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + BackupProtectedItemCountSummary, + BackupProtectionContainerCountSummary, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsrpQueryObject { + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] + pub restore_point_query_type: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "moveReadyRPOnly", default, skip_serializing_if = "Option::is_none")] + pub move_ready_rp_only: Option, +} +pub mod bmsrp_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestorePointQueryType { + Invalid, + Full, + Log, + Differential, + FullAndDifferential, + All, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupManagementUsage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] + pub next_reset_time: Option, + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +pub mod backup_management_usage { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupManagementUsageList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceConfig { + #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] + pub storage_model_type: Option, + #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] + pub storage_type: Option, + #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] + pub storage_type_state: Option, + #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] + pub cross_region_restore_flag: Option, +} +pub mod backup_resource_config { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageModelType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageTypeState { + Invalid, + Locked, + Unlocked, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceConfigResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientScriptForConnect { + #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] + pub script_content: Option, + #[serde(rename = "scriptExtension", default, skip_serializing_if = "Option::is_none")] + pub script_extension: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "scriptNameSuffix", default, skip_serializing_if = "Option::is_none")] + pub script_name_suffix: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrossRegionRestoreRequest { + #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] + pub cross_region_restore_access_details: Option, + #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] + pub restore_request: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrossRegionRestoreRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrrAccessToken { + #[serde(rename = "objectType")] + pub object_type: String, + #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] + pub access_token_string: Option, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub resource_group_name: Option, + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] + pub protection_container_id: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] + pub datasource_type: Option, + #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] + pub datasource_name: Option, + #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] + pub datasource_id: Option, + #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] + pub datasource_container_name: Option, + #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] + pub coordinator_service_stamp_id: Option, + #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] + pub coordinator_service_stamp_uri: Option, + #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] + pub protection_service_stamp_id: Option, + #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] + pub protection_service_stamp_uri: Option, + #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] + pub token_extended_information: Option, + #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] + pub rp_tier_information: Option, + #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] + pub rp_original_sa_option: Option, + #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] + pub rp_is_managed_virtual_machine: Option, + #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] + pub rp_vm_size_description: Option, + #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] + pub b_ms_active_region: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrrAccessTokenResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrrJobRequest { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrrJobRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod dpm_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmProtectedItemExtendedInfo { + #[serde(rename = "protectableObjectLoadPath", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_load_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protected: Option, + #[serde(rename = "isPresentOnCloud", default, skip_serializing_if = "Option::is_none")] + pub is_present_on_cloud: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "onPremiseOldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub on_premise_oldest_recovery_point: Option, + #[serde(rename = "onPremiseLatestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub on_premise_latest_recovery_point: Option, + #[serde(rename = "onPremiseRecoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub on_premise_recovery_point_count: Option, + #[serde(rename = "isCollocated", default, skip_serializing_if = "Option::is_none")] + pub is_collocated: Option, + #[serde(rename = "protectionGroupName", default, skip_serializing_if = "Option::is_none")] + pub protection_group_name: Option, + #[serde(rename = "diskStorageUsedInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_storage_used_in_bytes: Option, + #[serde(rename = "totalDiskStorageSizeInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_disk_storage_size_in_bytes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskExclusionProperties { + #[serde(rename = "diskLunList", default, skip_serializing_if = "Vec::is_empty")] + pub disk_lun_list: Vec, + #[serde(rename = "isInclusionList", default, skip_serializing_if = "Option::is_none")] + pub is_inclusion_list: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskInformation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmErrorInfo { + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "dpmServerName", default, skip_serializing_if = "Option::is_none")] + pub dpm_server_name: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionDetails { + #[serde(rename = "encryptionEnabled", default, skip_serializing_if = "Option::is_none")] + pub encryption_enabled: Option, + #[serde(rename = "kekUrl", default, skip_serializing_if = "Option::is_none")] + pub kek_url: Option, + #[serde(rename = "secretKeyUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_key_url: Option, + #[serde(rename = "kekVaultId", default, skip_serializing_if = "Option::is_none")] + pub kek_vault_id: Option, + #[serde(rename = "secretKeyVaultId", default, skip_serializing_if = "Option::is_none")] + pub secret_key_vault_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedProperties { + #[serde(rename = "diskExclusionProperties", default, skip_serializing_if = "Option::is_none")] + pub disk_exclusion_properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "protectedItemId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_id: Option, + #[serde(rename = "sourceAssociations", default, skip_serializing_if = "Option::is_none")] + pub source_associations: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, +} +pub mod generic_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_additional_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_additional_info: Option, + #[serde(rename = "sourceVMStorageType", default, skip_serializing_if = "Option::is_none")] + pub source_vm_storage_type: Option, + #[serde(rename = "isSourceVMEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_source_vm_encrypted: Option, + #[serde(rename = "keyAndSecret", default, skip_serializing_if = "Option::is_none")] + pub key_and_secret: Option, + #[serde(rename = "isInstantIlrSessionActive", default, skip_serializing_if = "Option::is_none")] + pub is_instant_ilr_session_active: Option, + #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_tier_details: Vec, + #[serde(rename = "isManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] + pub is_managed_virtual_machine: Option, + #[serde(rename = "virtualMachineSize", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_size: Option, + #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] + pub original_storage_account_option: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "recoveryPointDiskConfiguration", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_disk_configuration: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "recoveryPointMoveReadinessInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_move_readiness_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_machine_id: Option, + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[serde(rename = "virtualNetworkId", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_id: Option, + #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] + pub subnet_id: Option, + #[serde(rename = "targetDomainNameId", default, skip_serializing_if = "Option::is_none")] + pub target_domain_name_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, + #[serde(rename = "affinityGroup", default, skip_serializing_if = "Option::is_none")] + pub affinity_group: Option, + #[serde(rename = "createNewCloudService", default, skip_serializing_if = "Option::is_none")] + pub create_new_cloud_service: Option, + #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] + pub original_storage_account_option: Option, + #[serde(rename = "encryptionDetails", default, skip_serializing_if = "Option::is_none")] + pub encryption_details: Option, + #[serde(rename = "restoreDiskLunList", default, skip_serializing_if = "Vec::is_empty")] + pub restore_disk_lun_list: Vec, + #[serde(rename = "restoreWithManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub restore_with_managed_disks: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "identityInfo", default, skip_serializing_if = "Option::is_none")] + pub identity_info: Option, + #[serde(rename = "identityBasedRestoreDetails", default, skip_serializing_if = "Option::is_none")] + pub identity_based_restore_details: Option, +} +pub mod iaas_vm_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityBasedRestoreDetails { + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityInfo { + #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub is_system_assigned_identity: Option, + #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] + pub managed_identity_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InstantItemRecoveryTarget { + #[serde(rename = "clientScripts", default, skip_serializing_if = "Vec::is_empty")] + pub client_scripts: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Job { + #[serde(rename = "entityFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub entity_friendly_name: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, + #[serde(rename = "jobType")] + pub job_type: String, +} +pub mod job { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobQueryObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +pub mod job_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + InProgress, + Completed, + Failed, + CompletedWithWarnings, + Cancelled, + Cancelling, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operation { + Invalid, + Register, + UnRegister, + ConfigureBackup, + Backup, + Restore, + DisableBackup, + DeleteBackupData, + CrossRegionRestore, + Undelete, + UpdateCustomerManagedKey, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KekDetails { + #[serde(rename = "keyUrl", default, skip_serializing_if = "Option::is_none")] + pub key_url: Option, + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, + #[serde(rename = "keyBackupData", default, skip_serializing_if = "Option::is_none")] + pub key_backup_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KpiResourceHealthDetails { + #[serde(rename = "resourceHealthStatus", default, skip_serializing_if = "Option::is_none")] + pub resource_health_status: Option, + #[serde(rename = "resourceHealthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub resource_health_details: Vec, +} +pub mod kpi_resource_health_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceHealthStatus { + Healthy, + TransientDegraded, + PersistentDegraded, + TransientUnhealthy, + PersistentUnhealthy, + Invalid, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyAndSecretDetails { + #[serde(rename = "kekDetails", default, skip_serializing_if = "Option::is_none")] + pub kek_details: Option, + #[serde(rename = "bekDetails", default, skip_serializing_if = "Option::is_none")] + pub bek_details: Option, + #[serde(rename = "encryptionMechanism", default, skip_serializing_if = "Option::is_none")] + pub encryption_mechanism: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabErrorInfo { + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabFileFolderProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "deferredDeleteSyncTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_sync_time_in_utc: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabFileFolderProtectedItemExtendedInfo { + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "mabServerName", default, skip_serializing_if = "Option::is_none")] + pub mab_server_name: Option, + #[serde(rename = "mabServerType", default, skip_serializing_if = "Option::is_none")] + pub mab_server_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod mab_job { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MabServerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NameInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NewErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod new_error_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Error { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod operation_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + InProgress, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusExtendedInfo { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusJobExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusJobsExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "jobIds", default, skip_serializing_if = "Vec::is_empty")] + pub job_ids: Vec, + #[serde(rename = "failedJobsError", default, skip_serializing_if = "Option::is_none")] + pub failed_jobs_error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusProvisionIlrExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "recoveryTarget", default, skip_serializing_if = "Option::is_none")] + pub recovery_target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusRecoveryPointExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub updated_recovery_point: Option, + #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] + pub deleted_backup_item_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PointInTimeRange { + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItem { + #[serde(rename = "protectedItemType")] + pub protected_item_type: String, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "lastRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point: Option, + #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] + pub backup_set_name: Option, + #[serde(rename = "createMode", default, skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[serde(rename = "deferredDeleteTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_time_in_utc: Option, + #[serde(rename = "isScheduledForDeferredDelete", default, skip_serializing_if = "Option::is_none")] + pub is_scheduled_for_deferred_delete: Option, + #[serde(rename = "deferredDeleteTimeRemaining", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_time_remaining: Option, + #[serde(rename = "isDeferredDeleteScheduleUpcoming", default, skip_serializing_if = "Option::is_none")] + pub is_deferred_delete_schedule_upcoming: Option, + #[serde(rename = "isRehydrate", default, skip_serializing_if = "Option::is_none")] + pub is_rehydrate: Option, + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, +} +pub mod protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreateMode { + Invalid, + Default, + Recover, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemQueryObject { + #[serde(rename = "healthState", default, skip_serializing_if = "Option::is_none")] + pub health_state: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] + pub item_type: Option, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] + pub backup_set_name: Option, +} +pub mod protected_item_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthState { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ItemType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPoint { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointDiskConfiguration { + #[serde(rename = "numberOfDisksIncludedInBackup", default, skip_serializing_if = "Option::is_none")] + pub number_of_disks_included_in_backup: Option, + #[serde(rename = "numberOfDisksAttachedToVm", default, skip_serializing_if = "Option::is_none")] + pub number_of_disks_attached_to_vm: Option, + #[serde(rename = "includedDiskList", default, skip_serializing_if = "Vec::is_empty")] + pub included_disk_list: Vec, + #[serde(rename = "excludedDiskList", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_disk_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointMoveReadinessInfo { + #[serde(rename = "isReadyForMove", default, skip_serializing_if = "Option::is_none")] + pub is_ready_for_move: Option, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Option::is_none")] + pub additional_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointTierInformation { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod recovery_point_tier_information { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Valid, + Disabled, + Deleted, + Rehydrated, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceHealthDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreFileSpecs { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "fileSpecType", default, skip_serializing_if = "Option::is_none")] + pub file_spec_type: Option, + #[serde(rename = "targetFolderPath", default, skip_serializing_if = "Option::is_none")] + pub target_folder_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreRequest { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDataDirectory { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "logicalName", default, skip_serializing_if = "Option::is_none")] + pub logical_name: Option, +} +pub mod sql_data_directory { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Data, + Log, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDataDirectoryMapping { + #[serde(rename = "mappingType", default, skip_serializing_if = "Option::is_none")] + pub mapping_type: Option, + #[serde(rename = "sourceLogicalName", default, skip_serializing_if = "Option::is_none")] + pub source_logical_name: Option, + #[serde(rename = "sourcePath", default, skip_serializing_if = "Option::is_none")] + pub source_path: Option, + #[serde(rename = "targetPath", default, skip_serializing_if = "Option::is_none")] + pub target_path: Option, +} +pub mod sql_data_directory_mapping { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MappingType { + Invalid, + Data, + Log, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetAfsRestoreInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetRestoreInfo { + #[serde(rename = "overwriteOption", default, skip_serializing_if = "Option::is_none")] + pub overwrite_option: Option, + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(rename = "targetDirectoryForFileRestore", default, skip_serializing_if = "Option::is_none")] + pub target_directory_for_file_restore: Option, +} +pub mod target_restore_info { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OverwriteOption { + Invalid, + FailOnConflict, + Overwrite, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadCrrAccessToken { + #[serde(flatten)] + pub crr_access_token: CrrAccessToken, + #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_unique_name: Option, + #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_friendly_name: Option, + #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_workload_type: Option, + #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_protection_state: Option, + #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_container_host_os_name: Option, + #[serde( + rename = "protectableObjectParentLogicalContainerName", + default, + skip_serializing_if = "Option::is_none" + )] + pub protectable_object_parent_logical_container_name: Option, + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, +} diff --git a/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/operations.rs new file mode 100644 index 0000000000..0b02676aa9 --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2018_12_20/operations.rs @@ -0,0 +1,1453 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn aad_properties(&self) -> aad_properties::Client { + aad_properties::Client(self.clone()) + } + pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { + backup_crr_job_details::Client(self.clone()) + } + pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { + backup_crr_jobs::Client(self.clone()) + } + pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { + backup_protected_items_crr::Client(self.clone()) + } + pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { + backup_resource_storage_configs::Client(self.clone()) + } + pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { + backup_usage_summaries_crr::Client(self.clone()) + } + pub fn cross_region_restore(&self) -> cross_region_restore::Client { + cross_region_restore::Client(self.clone()) + } + pub fn crr_operation_results(&self) -> crr_operation_results::Client { + crr_operation_results::Client(self.clone()) + } + pub fn crr_operation_status(&self) -> crr_operation_status::Client { + crr_operation_status::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { + recovery_points_crr::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), + #[error(transparent)] + AadProperties_Get(#[from] aad_properties::get::Error), + #[error(transparent)] + CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), + #[error(transparent)] + BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), + #[error(transparent)] + BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), + #[error(transparent)] + CrrOperationResults_Get(#[from] crr_operation_results::get::Error), + #[error(transparent)] + CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), + #[error(transparent)] + RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), + #[error(transparent)] + BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), + #[error(transparent)] + BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), + #[error(transparent)] + BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), + #[error(transparent)] + RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), + #[error(transparent)] + BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), +} +pub mod backup_usage_summaries_crr { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupManagementUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod aad_properties { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Fetches the AAD properties from target region BCM stamp."] + pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AadPropertiesResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cross_region_restore { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] + pub fn trigger( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod trigger { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::CrossRegionRestoreRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_crr_job_details { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get CRR job details from target region."] + pub fn get( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::CrrJobRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_crr_jobs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of CRR jobs from the target region."] + pub fn list( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::CrrJobRequest, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod crr_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + azure_region: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod crr_operation_status { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + azure_region: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns the Access token for communication between BMS and Protection service"] + pub fn get_access_token( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + parameters: impl Into, + ) -> get_access_token::Builder { + get_access_token::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get_access_token { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + BadRequest400 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + pub(crate) parameters: models::AadPropertiesResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CrrAccessTokenResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_resource_storage_configs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn patch( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceConfigResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceConfigResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points_crr { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + filter: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_protected_items_crr { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/mod.rs b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/mod.rs new file mode 100644 index 0000000000..e2db4d9fdf --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-11-15"; diff --git a/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/models.rs b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/models.rs new file mode 100644 index 0000000000..13094895e0 --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/models.rs @@ -0,0 +1,1909 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadProperties { + #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_client_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, + #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_object_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadPropertiesResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "fileShareSnapshotUri", default, skip_serializing_if = "Option::is_none")] + pub file_share_snapshot_uri: Option, + #[serde(rename = "recoveryPointSizeInGB", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_size_in_gb: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "copyOptions", default, skip_serializing_if = "Option::is_none")] + pub copy_options: Option, + #[serde(rename = "restoreRequestType", default, skip_serializing_if = "Option::is_none")] + pub restore_request_type: Option, + #[serde(rename = "restoreFileSpecs", default, skip_serializing_if = "Vec::is_empty")] + pub restore_file_specs: Vec, + #[serde(rename = "targetDetails", default, skip_serializing_if = "Option::is_none")] + pub target_details: Option, +} +pub mod azure_file_share_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CopyOptions { + Invalid, + CreateCopy, + Skip, + Overwrite, + FailOnConflict, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestoreRequestType { + Invalid, + FullShareRestore, + ItemLevelRestore, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileshareProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod azure_fileshare_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthStatus { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileshareProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[serde(rename = "resourceStateSyncTime", default, skip_serializing_if = "Option::is_none")] + pub resource_state_sync_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSClassicComputeVmProtectedItem { + #[serde(flatten)] + pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSComputeVmProtectedItem { + #[serde(flatten)] + pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] + pub error_title: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmHealthDetails { + #[serde(flatten)] + pub resource_health_details: ResourceHealthDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "internalPropertyBag", default, skip_serializing_if = "Option::is_none")] + pub internal_property_bag: Option, + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, + #[serde(rename = "estimatedRemainingDuration", default, skip_serializing_if = "Option::is_none")] + pub estimated_remaining_duration: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "instanceId", default, skip_serializing_if = "Option::is_none")] + pub instance_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, + #[serde(rename = "taskExecutionDetails", default, skip_serializing_if = "Option::is_none")] + pub task_execution_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[serde(rename = "healthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_details: Vec, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_id: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "extendedProperties", default, skip_serializing_if = "Option::is_none")] + pub extended_properties: Option, +} +pub mod azure_iaa_svm_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthStatus { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyInconsistent", default, skip_serializing_if = "Option::is_none")] + pub policy_inconsistent: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_id: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod azure_sql_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_name: Option, + #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] + pub storage_account_version: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] + pub server_name: Option, + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[serde(rename = "parentType", default, skip_serializing_if = "Option::is_none")] + pub parent_type: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "lastBackupErrorDetail", default, skip_serializing_if = "Option::is_none")] + pub last_backup_error_detail: Option, + #[serde(rename = "protectedItemDataSourceId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_source_id: Option, + #[serde(rename = "protectedItemHealthStatus", default, skip_serializing_if = "Option::is_none")] + pub protected_item_health_status: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, +} +pub mod azure_vm_workload_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastBackupStatus { + Invalid, + Healthy, + Unhealthy, + #[serde(rename = "IRPending")] + IrPending, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectedItemHealthStatus { + Invalid, + Healthy, + Unhealthy, + NotReachable, + #[serde(rename = "IRPending")] + IrPending, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectedItemExtendedInfo { + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadErrorInfo { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] + pub error_title: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJob { + #[serde(flatten)] + pub job: Job, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, + #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub time_ranges: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time_in_utc: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_tier_details: Vec, + #[serde(rename = "recoveryPointMoveReadinessInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_move_readiness_info: Option, +} +pub mod azure_workload_recovery_point { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Full, + Log, + Differential, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "targetInfo", default, skip_serializing_if = "Option::is_none")] + pub target_info: Option, + #[serde(rename = "recoveryMode", default, skip_serializing_if = "Option::is_none")] + pub recovery_mode: Option, + #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_machine_id: Option, +} +pub mod azure_workload_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryMode { + Invalid, + FileRecovery, + WorkloadRecovery, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_point_in_time_recovery_point: AzureWorkloadPointInTimeRecoveryPoint, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, + #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub time_ranges: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest, + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRecoveryPointExtendedInfo { + #[serde(rename = "dataDirectoryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub data_directory_time_in_utc: Option, + #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub data_directory_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, + #[serde(rename = "shouldUseAlternateTargetLocation", default, skip_serializing_if = "Option::is_none")] + pub should_use_alternate_target_location: Option, + #[serde(rename = "isNonRecoverable", default, skip_serializing_if = "Option::is_none")] + pub is_non_recoverable: Option, + #[serde(rename = "alternateDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub alternate_directory_paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BekDetails { + #[serde(rename = "secretUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_url: Option, + #[serde(rename = "secretVaultId", default, skip_serializing_if = "Option::is_none")] + pub secret_vault_id: Option, + #[serde(rename = "secretData", default, skip_serializing_if = "Option::is_none")] + pub secret_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsaadPropertiesQueryObject { + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, +} +pub mod bmsaad_properties_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsBackupSummariesQueryObject { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod bms_backup_summaries_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + BackupProtectedItemCountSummary, + BackupProtectionContainerCountSummary, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsrpQueryObject { + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] + pub restore_point_query_type: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "moveReadyRPOnly", default, skip_serializing_if = "Option::is_none")] + pub move_ready_rp_only: Option, +} +pub mod bmsrp_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestorePointQueryType { + Invalid, + Full, + Log, + Differential, + FullAndDifferential, + All, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupManagementUsage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] + pub next_reset_time: Option, + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +pub mod backup_management_usage { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupManagementUsageList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceConfig { + #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] + pub storage_model_type: Option, + #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] + pub storage_type: Option, + #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] + pub storage_type_state: Option, + #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] + pub cross_region_restore_flag: Option, +} +pub mod backup_resource_config { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageModelType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageTypeState { + Invalid, + Locked, + Unlocked, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupResourceConfigResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientScriptForConnect { + #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] + pub script_content: Option, + #[serde(rename = "scriptExtension", default, skip_serializing_if = "Option::is_none")] + pub script_extension: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "scriptNameSuffix", default, skip_serializing_if = "Option::is_none")] + pub script_name_suffix: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrossRegionRestoreRequest { + #[serde(rename = "crossRegionRestoreAccessDetails", default, skip_serializing_if = "Option::is_none")] + pub cross_region_restore_access_details: Option, + #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] + pub restore_request: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrossRegionRestoreRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrrAccessToken { + #[serde(rename = "objectType")] + pub object_type: String, + #[serde(rename = "accessTokenString", default, skip_serializing_if = "Option::is_none")] + pub access_token_string: Option, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub resource_group_name: Option, + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "protectionContainerId", default, skip_serializing_if = "Option::is_none")] + pub protection_container_id: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] + pub datasource_type: Option, + #[serde(rename = "datasourceName", default, skip_serializing_if = "Option::is_none")] + pub datasource_name: Option, + #[serde(rename = "datasourceId", default, skip_serializing_if = "Option::is_none")] + pub datasource_id: Option, + #[serde(rename = "datasourceContainerName", default, skip_serializing_if = "Option::is_none")] + pub datasource_container_name: Option, + #[serde(rename = "coordinatorServiceStampId", default, skip_serializing_if = "Option::is_none")] + pub coordinator_service_stamp_id: Option, + #[serde(rename = "coordinatorServiceStampUri", default, skip_serializing_if = "Option::is_none")] + pub coordinator_service_stamp_uri: Option, + #[serde(rename = "protectionServiceStampId", default, skip_serializing_if = "Option::is_none")] + pub protection_service_stamp_id: Option, + #[serde(rename = "protectionServiceStampUri", default, skip_serializing_if = "Option::is_none")] + pub protection_service_stamp_uri: Option, + #[serde(rename = "tokenExtendedInformation", default, skip_serializing_if = "Option::is_none")] + pub token_extended_information: Option, + #[serde(rename = "rpTierInformation", default, skip_serializing_if = "Option::is_none")] + pub rp_tier_information: Option, + #[serde(rename = "rpOriginalSAOption", default, skip_serializing_if = "Option::is_none")] + pub rp_original_sa_option: Option, + #[serde(rename = "rpIsManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] + pub rp_is_managed_virtual_machine: Option, + #[serde(rename = "rpVMSizeDescription", default, skip_serializing_if = "Option::is_none")] + pub rp_vm_size_description: Option, + #[serde(rename = "bMSActiveRegion", default, skip_serializing_if = "Option::is_none")] + pub b_ms_active_region: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrrAccessTokenResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrrJobRequest { + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CrrJobRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod dpm_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmProtectedItemExtendedInfo { + #[serde(rename = "protectableObjectLoadPath", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_load_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protected: Option, + #[serde(rename = "isPresentOnCloud", default, skip_serializing_if = "Option::is_none")] + pub is_present_on_cloud: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[serde(rename = "onPremiseOldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub on_premise_oldest_recovery_point: Option, + #[serde(rename = "onPremiseLatestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub on_premise_latest_recovery_point: Option, + #[serde(rename = "onPremiseRecoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub on_premise_recovery_point_count: Option, + #[serde(rename = "isCollocated", default, skip_serializing_if = "Option::is_none")] + pub is_collocated: Option, + #[serde(rename = "protectionGroupName", default, skip_serializing_if = "Option::is_none")] + pub protection_group_name: Option, + #[serde(rename = "diskStorageUsedInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_storage_used_in_bytes: Option, + #[serde(rename = "totalDiskStorageSizeInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_disk_storage_size_in_bytes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskExclusionProperties { + #[serde(rename = "diskLunList", default, skip_serializing_if = "Vec::is_empty")] + pub disk_lun_list: Vec, + #[serde(rename = "isInclusionList", default, skip_serializing_if = "Option::is_none")] + pub is_inclusion_list: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskInformation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmErrorInfo { + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "dpmServerName", default, skip_serializing_if = "Option::is_none")] + pub dpm_server_name: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionDetails { + #[serde(rename = "encryptionEnabled", default, skip_serializing_if = "Option::is_none")] + pub encryption_enabled: Option, + #[serde(rename = "kekUrl", default, skip_serializing_if = "Option::is_none")] + pub kek_url: Option, + #[serde(rename = "secretKeyUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_key_url: Option, + #[serde(rename = "kekVaultId", default, skip_serializing_if = "Option::is_none")] + pub kek_vault_id: Option, + #[serde(rename = "secretKeyVaultId", default, skip_serializing_if = "Option::is_none")] + pub secret_key_vault_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedProperties { + #[serde(rename = "diskExclusionProperties", default, skip_serializing_if = "Option::is_none")] + pub disk_exclusion_properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "protectedItemId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_id: Option, + #[serde(rename = "sourceAssociations", default, skip_serializing_if = "Option::is_none")] + pub source_associations: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, +} +pub mod generic_protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_additional_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_additional_info: Option, + #[serde(rename = "sourceVMStorageType", default, skip_serializing_if = "Option::is_none")] + pub source_vm_storage_type: Option, + #[serde(rename = "isSourceVMEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_source_vm_encrypted: Option, + #[serde(rename = "keyAndSecret", default, skip_serializing_if = "Option::is_none")] + pub key_and_secret: Option, + #[serde(rename = "isInstantIlrSessionActive", default, skip_serializing_if = "Option::is_none")] + pub is_instant_ilr_session_active: Option, + #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_tier_details: Vec, + #[serde(rename = "isManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] + pub is_managed_virtual_machine: Option, + #[serde(rename = "virtualMachineSize", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_size: Option, + #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] + pub original_storage_account_option: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "recoveryPointDiskConfiguration", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_disk_configuration: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "recoveryPointMoveReadinessInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_move_readiness_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_machine_id: Option, + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[serde(rename = "virtualNetworkId", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_id: Option, + #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] + pub subnet_id: Option, + #[serde(rename = "targetDomainNameId", default, skip_serializing_if = "Option::is_none")] + pub target_domain_name_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, + #[serde(rename = "affinityGroup", default, skip_serializing_if = "Option::is_none")] + pub affinity_group: Option, + #[serde(rename = "createNewCloudService", default, skip_serializing_if = "Option::is_none")] + pub create_new_cloud_service: Option, + #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] + pub original_storage_account_option: Option, + #[serde(rename = "encryptionDetails", default, skip_serializing_if = "Option::is_none")] + pub encryption_details: Option, + #[serde(rename = "restoreDiskLunList", default, skip_serializing_if = "Vec::is_empty")] + pub restore_disk_lun_list: Vec, + #[serde(rename = "restoreWithManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub restore_with_managed_disks: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(rename = "identityInfo", default, skip_serializing_if = "Option::is_none")] + pub identity_info: Option, + #[serde(rename = "identityBasedRestoreDetails", default, skip_serializing_if = "Option::is_none")] + pub identity_based_restore_details: Option, +} +pub mod iaas_vm_restore_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityBasedRestoreDetails { + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityInfo { + #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub is_system_assigned_identity: Option, + #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] + pub managed_identity_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InstantItemRecoveryTarget { + #[serde(rename = "clientScripts", default, skip_serializing_if = "Vec::is_empty")] + pub client_scripts: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Job { + #[serde(rename = "entityFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub entity_friendly_name: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, + #[serde(rename = "jobType")] + pub job_type: String, +} +pub mod job { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobQueryObject { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +pub mod job_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + InProgress, + Completed, + Failed, + CompletedWithWarnings, + Cancelled, + Cancelling, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operation { + Invalid, + Register, + UnRegister, + ConfigureBackup, + Backup, + Restore, + DisableBackup, + DeleteBackupData, + CrossRegionRestore, + Undelete, + UpdateCustomerManagedKey, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KekDetails { + #[serde(rename = "keyUrl", default, skip_serializing_if = "Option::is_none")] + pub key_url: Option, + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, + #[serde(rename = "keyBackupData", default, skip_serializing_if = "Option::is_none")] + pub key_backup_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KpiResourceHealthDetails { + #[serde(rename = "resourceHealthStatus", default, skip_serializing_if = "Option::is_none")] + pub resource_health_status: Option, + #[serde(rename = "resourceHealthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub resource_health_details: Vec, +} +pub mod kpi_resource_health_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceHealthStatus { + Healthy, + TransientDegraded, + PersistentDegraded, + TransientUnhealthy, + PersistentUnhealthy, + Invalid, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyAndSecretDetails { + #[serde(rename = "kekDetails", default, skip_serializing_if = "Option::is_none")] + pub kek_details: Option, + #[serde(rename = "bekDetails", default, skip_serializing_if = "Option::is_none")] + pub bek_details: Option, + #[serde(rename = "encryptionMechanism", default, skip_serializing_if = "Option::is_none")] + pub encryption_mechanism: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabErrorInfo { + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabFileFolderProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "deferredDeleteSyncTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_sync_time_in_utc: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabFileFolderProtectedItemExtendedInfo { + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJob { + #[serde(flatten)] + pub job: Job, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[serde(rename = "mabServerName", default, skip_serializing_if = "Option::is_none")] + pub mab_server_name: Option, + #[serde(rename = "mabServerType", default, skip_serializing_if = "Option::is_none")] + pub mab_server_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod mab_job { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MabServerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJobExtendedInfo { + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJobTaskDetails { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NameInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NewErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod new_error_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Error { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod operation_status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + InProgress, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusExtendedInfo { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusJobExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusJobsExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "jobIds", default, skip_serializing_if = "Vec::is_empty")] + pub job_ids: Vec, + #[serde(rename = "failedJobsError", default, skip_serializing_if = "Option::is_none")] + pub failed_jobs_error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusProvisionIlrExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "recoveryTarget", default, skip_serializing_if = "Option::is_none")] + pub recovery_target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusRecoveryPointExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[serde(rename = "updatedRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub updated_recovery_point: Option, + #[serde(rename = "deletedBackupItemVersion", default, skip_serializing_if = "Option::is_none")] + pub deleted_backup_item_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PointInTimeRange { + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItem { + #[serde(rename = "protectedItemType")] + pub protected_item_type: String, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "lastRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point: Option, + #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] + pub backup_set_name: Option, + #[serde(rename = "createMode", default, skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[serde(rename = "deferredDeleteTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_time_in_utc: Option, + #[serde(rename = "isScheduledForDeferredDelete", default, skip_serializing_if = "Option::is_none")] + pub is_scheduled_for_deferred_delete: Option, + #[serde(rename = "deferredDeleteTimeRemaining", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_time_remaining: Option, + #[serde(rename = "isDeferredDeleteScheduleUpcoming", default, skip_serializing_if = "Option::is_none")] + pub is_deferred_delete_schedule_upcoming: Option, + #[serde(rename = "isRehydrate", default, skip_serializing_if = "Option::is_none")] + pub is_rehydrate: Option, + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, +} +pub mod protected_item { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreateMode { + Invalid, + Default, + Recover, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemQueryObject { + #[serde(rename = "healthState", default, skip_serializing_if = "Option::is_none")] + pub health_state: Option, + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] + pub item_type: Option, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] + pub backup_set_name: Option, +} +pub mod protected_item_query_object { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthState { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ItemType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPoint { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointDiskConfiguration { + #[serde(rename = "numberOfDisksIncludedInBackup", default, skip_serializing_if = "Option::is_none")] + pub number_of_disks_included_in_backup: Option, + #[serde(rename = "numberOfDisksAttachedToVm", default, skip_serializing_if = "Option::is_none")] + pub number_of_disks_attached_to_vm: Option, + #[serde(rename = "includedDiskList", default, skip_serializing_if = "Vec::is_empty")] + pub included_disk_list: Vec, + #[serde(rename = "excludedDiskList", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_disk_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointMoveReadinessInfo { + #[serde(rename = "isReadyForMove", default, skip_serializing_if = "Option::is_none")] + pub is_ready_for_move: Option, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Option::is_none")] + pub additional_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointTierInformation { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +pub mod recovery_point_tier_information { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Valid, + Disabled, + Deleted, + Rehydrated, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceHealthDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreFileSpecs { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "fileSpecType", default, skip_serializing_if = "Option::is_none")] + pub file_spec_type: Option, + #[serde(rename = "targetFolderPath", default, skip_serializing_if = "Option::is_none")] + pub target_folder_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreRequest { + #[serde(rename = "objectType")] + pub object_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDataDirectory { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "logicalName", default, skip_serializing_if = "Option::is_none")] + pub logical_name: Option, +} +pub mod sql_data_directory { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Data, + Log, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDataDirectoryMapping { + #[serde(rename = "mappingType", default, skip_serializing_if = "Option::is_none")] + pub mapping_type: Option, + #[serde(rename = "sourceLogicalName", default, skip_serializing_if = "Option::is_none")] + pub source_logical_name: Option, + #[serde(rename = "sourcePath", default, skip_serializing_if = "Option::is_none")] + pub source_path: Option, + #[serde(rename = "targetPath", default, skip_serializing_if = "Option::is_none")] + pub target_path: Option, +} +pub mod sql_data_directory_mapping { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MappingType { + Invalid, + Data, + Log, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetAfsRestoreInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetRestoreInfo { + #[serde(rename = "overwriteOption", default, skip_serializing_if = "Option::is_none")] + pub overwrite_option: Option, + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(rename = "targetDirectoryForFileRestore", default, skip_serializing_if = "Option::is_none")] + pub target_directory_for_file_restore: Option, +} +pub mod target_restore_info { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OverwriteOption { + Invalid, + FailOnConflict, + Overwrite, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadCrrAccessToken { + #[serde(flatten)] + pub crr_access_token: CrrAccessToken, + #[serde(rename = "protectableObjectUniqueName", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_unique_name: Option, + #[serde(rename = "protectableObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_friendly_name: Option, + #[serde(rename = "protectableObjectWorkloadType", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_workload_type: Option, + #[serde(rename = "protectableObjectProtectionState", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_protection_state: Option, + #[serde(rename = "protectableObjectContainerHostOsName", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_container_host_os_name: Option, + #[serde( + rename = "protectableObjectParentLogicalContainerName", + default, + skip_serializing_if = "Option::is_none" + )] + pub protectable_object_parent_logical_container_name: Option, + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, +} diff --git a/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/operations.rs new file mode 100644 index 0000000000..0b02676aa9 --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_passivestamp_2021_11_15/operations.rs @@ -0,0 +1,1453 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn aad_properties(&self) -> aad_properties::Client { + aad_properties::Client(self.clone()) + } + pub fn backup_crr_job_details(&self) -> backup_crr_job_details::Client { + backup_crr_job_details::Client(self.clone()) + } + pub fn backup_crr_jobs(&self) -> backup_crr_jobs::Client { + backup_crr_jobs::Client(self.clone()) + } + pub fn backup_protected_items_crr(&self) -> backup_protected_items_crr::Client { + backup_protected_items_crr::Client(self.clone()) + } + pub fn backup_resource_storage_configs(&self) -> backup_resource_storage_configs::Client { + backup_resource_storage_configs::Client(self.clone()) + } + pub fn backup_usage_summaries_crr(&self) -> backup_usage_summaries_crr::Client { + backup_usage_summaries_crr::Client(self.clone()) + } + pub fn cross_region_restore(&self) -> cross_region_restore::Client { + cross_region_restore::Client(self.clone()) + } + pub fn crr_operation_results(&self) -> crr_operation_results::Client { + crr_operation_results::Client(self.clone()) + } + pub fn crr_operation_status(&self) -> crr_operation_status::Client { + crr_operation_status::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn recovery_points_crr(&self) -> recovery_points_crr::Client { + recovery_points_crr::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + BackupUsageSummariesCrr_List(#[from] backup_usage_summaries_crr::list::Error), + #[error(transparent)] + AadProperties_Get(#[from] aad_properties::get::Error), + #[error(transparent)] + CrossRegionRestore_Trigger(#[from] cross_region_restore::trigger::Error), + #[error(transparent)] + BackupCrrJobDetails_Get(#[from] backup_crr_job_details::get::Error), + #[error(transparent)] + BackupCrrJobs_List(#[from] backup_crr_jobs::list::Error), + #[error(transparent)] + CrrOperationResults_Get(#[from] crr_operation_results::get::Error), + #[error(transparent)] + CrrOperationStatus_Get(#[from] crr_operation_status::get::Error), + #[error(transparent)] + RecoveryPoints_GetAccessToken(#[from] recovery_points::get_access_token::Error), + #[error(transparent)] + BackupResourceStorageConfigs_Get(#[from] backup_resource_storage_configs::get::Error), + #[error(transparent)] + BackupResourceStorageConfigs_Update(#[from] backup_resource_storage_configs::update::Error), + #[error(transparent)] + BackupResourceStorageConfigs_Patch(#[from] backup_resource_storage_configs::patch::Error), + #[error(transparent)] + RecoveryPointsCrr_List(#[from] recovery_points_crr::list::Error), + #[error(transparent)] + BackupProtectedItemsCrr_List(#[from] backup_protected_items_crr::list::Error), +} +pub mod backup_usage_summaries_crr { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupManagementUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod aad_properties { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Fetches the AAD properties from target region BCM stamp."] + pub fn get(&self, azure_region: impl Into, subscription_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupAadProperties", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AadPropertiesResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cross_region_restore { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Restores the specified backed up data in a different region as compared to where the data is backed up."] + pub fn trigger( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod trigger { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::CrossRegionRestoreRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrossRegionRestore", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_crr_job_details { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get CRR job details from target region."] + pub fn get( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::CrrJobRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJob", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_crr_jobs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of CRR jobs from the target region."] + pub fn list( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::CrrJobRequest, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrJobs", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod crr_operation_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + azure_region: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod crr_operation_status { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + azure_region: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupCrrOperationsStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns the Access token for communication between BMS and Protection service"] + pub fn get_access_token( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + parameters: impl Into, + ) -> get_access_token::Builder { + get_access_token::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get_access_token { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + BadRequest400 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + pub(crate) parameters: models::AadPropertiesResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/accessToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CrrAccessTokenResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_resource_storage_configs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn patch( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceConfigResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceConfigResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points_crr { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + filter: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_protected_items_crr { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems/", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/recoveryservicessiterecovery/Cargo.toml b/services/mgmt/recoveryservicessiterecovery/Cargo.toml index 987d27d3cd..dc7b271442 100644 --- a/services/mgmt/recoveryservicessiterecovery/Cargo.toml +++ b/services/mgmt/recoveryservicessiterecovery/Cargo.toml @@ -19,10 +19,11 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2021-08", "enable_reqwest"] +default = ["package-2021-10", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-10" = [] "package-2021-08" = [] "package-2021-07" = [] "package-2021-06" = [] diff --git a/services/mgmt/recoveryservicessiterecovery/src/lib.rs b/services/mgmt/recoveryservicessiterecovery/src/lib.rs index 416151c8ca..cdf74feeaa 100644 --- a/services/mgmt/recoveryservicessiterecovery/src/lib.rs +++ b/services/mgmt/recoveryservicessiterecovery/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-10")] +pub mod package_2021_10; +#[cfg(all(feature = "package-2021-10", not(feature = "no-default-version")))] +pub use package_2021_10::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-08")] pub mod package_2021_08; #[cfg(all(feature = "package-2021-08", not(feature = "no-default-version")))] diff --git a/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/mod.rs b/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/mod.rs new file mode 100644 index 0000000000..cdd7552b47 --- /dev/null +++ b/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-10-01"; diff --git a/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/models.rs b/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/models.rs new file mode 100644 index 0000000000..8f4312a8d1 --- /dev/null +++ b/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/models.rs @@ -0,0 +1,7314 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aAddDisksInput { + #[serde(flatten)] + pub add_disks_provider_specific_input: AddDisksProviderSpecificInput, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aContainerCreationInput { + #[serde(flatten)] + pub replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aContainerMappingInput { + #[serde(flatten)] + pub replication_provider_specific_container_mapping_input: ReplicationProviderSpecificContainerMappingInput, + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, +} +pub mod a2a_container_mapping_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCreateProtectionIntentInput { + #[serde(flatten)] + pub create_protection_intent_provider_specific_details: CreateProtectionIntentProviderSpecificDetails, + #[serde(rename = "fabricObjectId")] + pub fabric_object_id: String, + #[serde(rename = "primaryLocation")] + pub primary_location: String, + #[serde(rename = "recoveryLocation")] + pub recovery_location: String, + #[serde(rename = "recoverySubscriptionId")] + pub recovery_subscription_id: String, + #[serde(rename = "recoveryAvailabilityType")] + pub recovery_availability_type: a2a_create_protection_intent_input::RecoveryAvailabilityType, + #[serde(rename = "protectionProfileCustomInput", default, skip_serializing_if = "Option::is_none")] + pub protection_profile_custom_input: Option, + #[serde(rename = "recoveryResourceGroupId")] + pub recovery_resource_group_id: String, + #[serde( + rename = "primaryStagingStorageAccountCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub primary_staging_storage_account_custom_input: Option, + #[serde(rename = "recoveryAvailabilitySetCustomInput", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_custom_input: Option, + #[serde(rename = "recoveryVirtualNetworkCustomInput", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_network_custom_input: Option, + #[serde( + rename = "recoveryProximityPlacementGroupCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub recovery_proximity_placement_group_custom_input: Option, + #[serde(rename = "autoProtectionOfDataDisk", default, skip_serializing_if = "Option::is_none")] + pub auto_protection_of_data_disk: Option, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[serde(rename = "recoveryBootDiagStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account: Option, + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, +} +pub mod a2a_create_protection_intent_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryAvailabilityType { + Single, + AvailabilitySet, + AvailabilityZone, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoProtectionOfDataDisk { + Disabled, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationContainerCreationInput { + #[serde(flatten)] + pub replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(rename = "primaryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_location: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[serde(rename = "lifecycleId", default, skip_serializing_if = "Option::is_none")] + pub lifecycle_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[serde(rename = "fabricObjectId")] + pub fabric_object_id: String, + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[serde(rename = "recoveryCloudServiceId", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service_id: Option, + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[serde(rename = "recoveryBootDiagStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account_id: Option, + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[serde(rename = "recoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_network_id: Option, + #[serde(rename = "recoverySubnetName", default, skip_serializing_if = "Option::is_none")] + pub recovery_subnet_name: Option, + #[serde(rename = "recoveryVirtualMachineScaleSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_machine_scale_set_id: Option, + #[serde(rename = "recoveryCapacityReservationGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_capacity_reservation_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "fabricLocation", default, skip_serializing_if = "Option::is_none")] + pub fabric_location: Option, + #[serde(rename = "remoteFabricName", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_name: Option, + #[serde(rename = "remoteFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "multiVmSyncStatus")] + pub multi_vm_sync_status: a2a_policy_creation_input::MultiVmSyncStatus, +} +pub mod a2a_policy_creation_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncStatus { + Enable, + Disable, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aProtectedDiskDetails { + #[serde(rename = "diskUri", default, skip_serializing_if = "Option::is_none")] + pub disk_uri: Option, + #[serde(rename = "recoveryAzureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_storage_account_id: Option, + #[serde(rename = "primaryDiskAzureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub primary_disk_azure_storage_account_id: Option, + #[serde(rename = "recoveryDiskUri", default, skip_serializing_if = "Option::is_none")] + pub recovery_disk_uri: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "diskCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity_in_bytes: Option, + #[serde(rename = "primaryStagingAzureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub primary_staging_azure_storage_account_id: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[serde(rename = "monitoringPercentageCompletion", default, skip_serializing_if = "Option::is_none")] + pub monitoring_percentage_completion: Option, + #[serde(rename = "monitoringJobType", default, skip_serializing_if = "Option::is_none")] + pub monitoring_job_type: Option, + #[serde( + rename = "dataPendingInStagingStorageAccountInMB", + default, + skip_serializing_if = "Option::is_none" + )] + pub data_pending_in_staging_storage_account_in_mb: Option, + #[serde(rename = "dataPendingAtSourceAgentInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_at_source_agent_in_mb: Option, + #[serde(rename = "diskState", default, skip_serializing_if = "Option::is_none")] + pub disk_state: Option, + #[serde(rename = "allowedDiskLevelOperation", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_disk_level_operation: Vec, + #[serde(rename = "isDiskEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_disk_encrypted: Option, + #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub secret_identifier: Option, + #[serde(rename = "dekKeyVaultArmId", default, skip_serializing_if = "Option::is_none")] + pub dek_key_vault_arm_id: Option, + #[serde(rename = "isDiskKeyEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_disk_key_encrypted: Option, + #[serde(rename = "keyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub key_identifier: Option, + #[serde(rename = "kekKeyVaultArmId", default, skip_serializing_if = "Option::is_none")] + pub kek_key_vault_arm_id: Option, + #[serde(rename = "failoverDiskName", default, skip_serializing_if = "Option::is_none")] + pub failover_disk_name: Option, + #[serde(rename = "tfoDiskName", default, skip_serializing_if = "Option::is_none")] + pub tfo_disk_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aProtectedManagedDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[serde(rename = "recoveryTargetDiskId", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_id: Option, + #[serde(rename = "recoveryReplicaDiskId", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_id: Option, + #[serde(rename = "recoveryOrignalTargetDiskId", default, skip_serializing_if = "Option::is_none")] + pub recovery_orignal_target_disk_id: Option, + #[serde(rename = "recoveryReplicaDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_account_type: Option, + #[serde(rename = "recoveryTargetDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_account_type: Option, + #[serde(rename = "recoveryDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_disk_encryption_set_id: Option, + #[serde(rename = "primaryDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub primary_disk_encryption_set_id: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "diskCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity_in_bytes: Option, + #[serde(rename = "primaryStagingAzureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub primary_staging_azure_storage_account_id: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[serde(rename = "monitoringPercentageCompletion", default, skip_serializing_if = "Option::is_none")] + pub monitoring_percentage_completion: Option, + #[serde(rename = "monitoringJobType", default, skip_serializing_if = "Option::is_none")] + pub monitoring_job_type: Option, + #[serde( + rename = "dataPendingInStagingStorageAccountInMB", + default, + skip_serializing_if = "Option::is_none" + )] + pub data_pending_in_staging_storage_account_in_mb: Option, + #[serde(rename = "dataPendingAtSourceAgentInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_at_source_agent_in_mb: Option, + #[serde(rename = "diskState", default, skip_serializing_if = "Option::is_none")] + pub disk_state: Option, + #[serde(rename = "allowedDiskLevelOperation", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_disk_level_operation: Vec, + #[serde(rename = "isDiskEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_disk_encrypted: Option, + #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub secret_identifier: Option, + #[serde(rename = "dekKeyVaultArmId", default, skip_serializing_if = "Option::is_none")] + pub dek_key_vault_arm_id: Option, + #[serde(rename = "isDiskKeyEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_disk_key_encrypted: Option, + #[serde(rename = "keyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub key_identifier: Option, + #[serde(rename = "kekKeyVaultArmId", default, skip_serializing_if = "Option::is_none")] + pub kek_key_vault_arm_id: Option, + #[serde(rename = "failoverDiskName", default, skip_serializing_if = "Option::is_none")] + pub failover_disk_name: Option, + #[serde(rename = "tfoDiskName", default, skip_serializing_if = "Option::is_none")] + pub tfo_disk_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aProtectionContainerMappingDetails { + #[serde(flatten)] + pub protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails, + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, + #[serde(rename = "scheduleName", default, skip_serializing_if = "Option::is_none")] + pub schedule_name: Option, + #[serde(rename = "jobScheduleName", default, skip_serializing_if = "Option::is_none")] + pub job_schedule_name: Option, +} +pub mod a2a_protection_container_mapping_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aProtectionIntentDiskInputDetails { + #[serde(rename = "diskUri")] + pub disk_uri: String, + #[serde( + rename = "recoveryAzureStorageAccountCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub recovery_azure_storage_account_custom_input: Option, + #[serde( + rename = "primaryStagingStorageAccountCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub primary_staging_storage_account_custom_input: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aProtectionIntentManagedDiskInputDetails { + #[serde(rename = "diskId")] + pub disk_id: String, + #[serde( + rename = "primaryStagingStorageAccountCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub primary_staging_storage_account_custom_input: Option, + #[serde(rename = "recoveryResourceGroupCustomInput", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_custom_input: Option, + #[serde(rename = "recoveryReplicaDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_account_type: Option, + #[serde(rename = "recoveryTargetDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_account_type: Option, + #[serde(rename = "recoveryDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_disk_encryption_set_id: Option, + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aRecoveryPointDetails { + #[serde(flatten)] + pub provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails, + #[serde(rename = "recoveryPointSyncType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_sync_type: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, +} +pub mod a2a_recovery_point_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointSyncType { + MultiVmSyncRecoveryPoint, + PerVmRecoveryPoint, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aRemoveDisksInput { + #[serde(flatten)] + pub remove_disks_provider_specific_input: RemoveDisksProviderSpecificInput, + #[serde(rename = "vmDisksUris", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks_uris: Vec, + #[serde(rename = "vmManagedDisksIds", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(rename = "initialPrimaryZone", default, skip_serializing_if = "Option::is_none")] + pub initial_primary_zone: Option, + #[serde(rename = "initialPrimaryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub initial_primary_fabric_location: Option, + #[serde(rename = "initialRecoveryZone", default, skip_serializing_if = "Option::is_none")] + pub initial_recovery_zone: Option, + #[serde(rename = "initialRecoveryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub initial_recovery_fabric_location: Option, + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "multiVmGroupCreateOption", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_create_option: Option, + #[serde(rename = "managementId", default, skip_serializing_if = "Option::is_none")] + pub management_id: Option, + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[serde(rename = "unprotectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub unprotected_disks: Vec, + #[serde(rename = "protectedManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_managed_disks: Vec, + #[serde(rename = "recoveryBootDiagStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account_id: Option, + #[serde(rename = "primaryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_location: Option, + #[serde(rename = "recoveryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_location: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "recoveryAzureVMSize", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_size: Option, + #[serde(rename = "recoveryAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_name: Option, + #[serde(rename = "recoveryAzureResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_resource_group_id: Option, + #[serde(rename = "recoveryCloudService", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service: Option, + #[serde(rename = "recoveryAvailabilitySet", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set: Option, + #[serde(rename = "selectedRecoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_recovery_azure_network_id: Option, + #[serde(rename = "selectedTfoAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_tfo_azure_network_id: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "vmSyncedConfigDetails", default, skip_serializing_if = "Option::is_none")] + pub vm_synced_config_details: Option, + #[serde(rename = "monitoringPercentageCompletion", default, skip_serializing_if = "Option::is_none")] + pub monitoring_percentage_completion: Option, + #[serde(rename = "monitoringJobType", default, skip_serializing_if = "Option::is_none")] + pub monitoring_job_type: Option, + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[serde(rename = "isReplicationAgentUpdateRequired", default, skip_serializing_if = "Option::is_none")] + pub is_replication_agent_update_required: Option, + #[serde(rename = "agentCertificateExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_certificate_expiry_date: Option, + #[serde( + rename = "isReplicationAgentCertificateUpdateRequired", + default, + skip_serializing_if = "Option::is_none" + )] + pub is_replication_agent_certificate_update_required: Option, + #[serde(rename = "recoveryFabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_object_id: Option, + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[serde(rename = "lifecycleId", default, skip_serializing_if = "Option::is_none")] + pub lifecycle_id: Option, + #[serde(rename = "testFailoverRecoveryFabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub test_failover_recovery_fabric_object_id: Option, + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[serde(rename = "primaryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub primary_availability_zone: Option, + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[serde(rename = "vmEncryptionType", default, skip_serializing_if = "Option::is_none")] + pub vm_encryption_type: Option, + #[serde(rename = "tfoAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub tfo_azure_vm_name: Option, + #[serde(rename = "recoveryAzureGeneration", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_generation: Option, + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, + #[serde(rename = "autoProtectionOfDataDisk", default, skip_serializing_if = "Option::is_none")] + pub auto_protection_of_data_disk: Option, + #[serde(rename = "recoveryVirtualMachineScaleSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_machine_scale_set_id: Option, + #[serde(rename = "recoveryCapacityReservationGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_capacity_reservation_group_id: Option, +} +pub mod a2a_replication_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmGroupCreateOption { + AutoCreated, + UserSpecified, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VmEncryptionType { + NotEncrypted, + OnePassEncrypted, + TwoPassEncrypted, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoProtectionOfDataDisk { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aReplicationIntentDetails { + #[serde(flatten)] + pub replication_protection_intent_provider_specific_settings: ReplicationProtectionIntentProviderSpecificSettings, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(rename = "primaryLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_location: Option, + #[serde(rename = "recoveryLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_location: Option, + #[serde(rename = "recoverySubscriptionId", default, skip_serializing_if = "Option::is_none")] + pub recovery_subscription_id: Option, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[serde(rename = "protectionProfile", default, skip_serializing_if = "Option::is_none")] + pub protection_profile: Option, + #[serde(rename = "primaryStagingStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub primary_staging_storage_account: Option, + #[serde(rename = "recoveryAvailabilitySet", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set: Option, + #[serde(rename = "recoveryVirtualNetwork", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_network: Option, + #[serde(rename = "recoveryProximityPlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group: Option, + #[serde(rename = "autoProtectionOfDataDisk", default, skip_serializing_if = "Option::is_none")] + pub auto_protection_of_data_disk: Option, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[serde(rename = "recoveryBootDiagStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account: Option, + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[serde(rename = "recoveryAvailabilityType")] + pub recovery_availability_type: String, + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, +} +pub mod a2a_replication_intent_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoProtectionOfDataDisk { + Disabled, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[serde(rename = "recoveryCloudServiceId", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service_id: Option, + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aSwitchProtectionInput { + #[serde(flatten)] + pub switch_protection_provider_specific_input: SwitchProtectionProviderSpecificInput, + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[serde(rename = "recoveryCloudServiceId", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service_id: Option, + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "recoveryBootDiagStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account_id: Option, + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, + #[serde(rename = "recoveryVirtualMachineScaleSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_machine_scale_set_id: Option, + #[serde(rename = "recoveryCapacityReservationGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_capacity_reservation_group_id: Option, + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aTestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "cloudServiceCreationOption", default, skip_serializing_if = "Option::is_none")] + pub cloud_service_creation_option: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aUnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "cloudServiceCreationOption", default, skip_serializing_if = "Option::is_none")] + pub cloud_service_creation_option: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aUnprotectedDiskDetails { + #[serde(rename = "diskLunId", default, skip_serializing_if = "Option::is_none")] + pub disk_lun_id: Option, + #[serde(rename = "diskAutoProtectionStatus", default, skip_serializing_if = "Option::is_none")] + pub disk_auto_protection_status: Option, +} +pub mod a2a_unprotected_disk_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskAutoProtectionStatus { + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aUpdateContainerMappingInput { + #[serde(flatten)] + pub replication_provider_specific_update_container_mapping_input: ReplicationProviderSpecificUpdateContainerMappingInput, + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, +} +pub mod a2a_update_container_mapping_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aUpdateReplicationProtectedItemInput { + #[serde(flatten)] + pub update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput, + #[serde(rename = "recoveryCloudServiceId", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service_id: Option, + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[serde(rename = "managedDiskUpdateDetails", default, skip_serializing_if = "Vec::is_empty")] + pub managed_disk_update_details: Vec, + #[serde(rename = "recoveryBootDiagStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account_id: Option, + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[serde(rename = "tfoAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub tfo_azure_vm_name: Option, + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, + #[serde(rename = "recoveryVirtualMachineScaleSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_machine_scale_set_id: Option, + #[serde(rename = "recoveryCapacityReservationGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_capacity_reservation_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aVmDiskInputDetails { + #[serde(rename = "diskUri")] + pub disk_uri: String, + #[serde(rename = "recoveryAzureStorageAccountId")] + pub recovery_azure_storage_account_id: String, + #[serde(rename = "primaryStagingAzureStorageAccountId")] + pub primary_staging_azure_storage_account_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aVmManagedDiskInputDetails { + #[serde(rename = "diskId")] + pub disk_id: String, + #[serde(rename = "primaryStagingAzureStorageAccountId")] + pub primary_staging_azure_storage_account_id: String, + #[serde(rename = "recoveryResourceGroupId")] + pub recovery_resource_group_id: String, + #[serde(rename = "recoveryReplicaDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_account_type: Option, + #[serde(rename = "recoveryTargetDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_account_type: Option, + #[serde(rename = "recoveryDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_disk_encryption_set_id: Option, + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aVmManagedDiskUpdateDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "recoveryTargetDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_account_type: Option, + #[serde(rename = "recoveryReplicaDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_account_type: Option, + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[serde(rename = "failoverDiskName", default, skip_serializing_if = "Option::is_none")] + pub failover_disk_name: Option, + #[serde(rename = "tfoDiskName", default, skip_serializing_if = "Option::is_none")] + pub tfo_disk_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aZoneDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsrTask { + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "allowedActions", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_actions: Vec, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "stateDescription", default, skip_serializing_if = "Option::is_none")] + pub state_description: Option, + #[serde(rename = "taskType", default, skip_serializing_if = "Option::is_none")] + pub task_type: Option, + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, + #[serde(rename = "groupTaskCustomDetails", default, skip_serializing_if = "Option::is_none")] + pub group_task_custom_details: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddDisksInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddDisksInputProperties { + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: AddDisksProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddDisksProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddRecoveryServicesProviderInput { + pub properties: AddRecoveryServicesProviderInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddRecoveryServicesProviderInputProperties { + #[serde(rename = "machineName")] + pub machine_name: String, + #[serde(rename = "machineId", default, skip_serializing_if = "Option::is_none")] + pub machine_id: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(rename = "authenticationIdentityInput")] + pub authentication_identity_input: IdentityProviderInput, + #[serde(rename = "resourceAccessIdentityInput")] + pub resource_access_identity_input: IdentityProviderInput, + #[serde(rename = "dataPlaneAuthenticationIdentityInput", default, skip_serializing_if = "Option::is_none")] + pub data_plane_authentication_identity_input: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddVCenterRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddVCenterRequestProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentDetails { + #[serde(rename = "agentId", default, skip_serializing_if = "Option::is_none")] + pub agent_id: Option, + #[serde(rename = "machineId", default, skip_serializing_if = "Option::is_none")] + pub machine_id: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[serde(rename = "lunId", default, skip_serializing_if = "Option::is_none")] + pub lun_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Alert { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertProperties { + #[serde(rename = "sendToOwners", default, skip_serializing_if = "Option::is_none")] + pub send_to_owners: Option, + #[serde(rename = "customEmailAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub custom_email_addresses: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub locale: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplyRecoveryPointInput { + pub properties: ApplyRecoveryPointInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplyRecoveryPointInputProperties { + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: ApplyRecoveryPointProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplyRecoveryPointProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsrJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRunbookTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "cloudServiceName", default, skip_serializing_if = "Option::is_none")] + pub cloud_service_name: Option, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[serde(rename = "runbookId", default, skip_serializing_if = "Option::is_none")] + pub runbook_id: Option, + #[serde(rename = "runbookName", default, skip_serializing_if = "Option::is_none")] + pub runbook_name: Option, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "jobOutput", default, skip_serializing_if = "Option::is_none")] + pub job_output: Option, + #[serde(rename = "isPrimarySideScript", default, skip_serializing_if = "Option::is_none")] + pub is_primary_side_script: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFabricCreationInput { + #[serde(flatten)] + pub fabric_specific_creation_input: FabricSpecificCreationInput, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFabricSpecificDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(rename = "containerIds", default, skip_serializing_if = "Vec::is_empty")] + pub container_ids: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureToAzureCreateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput, + #[serde(rename = "primaryNetworkId")] + pub primary_network_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureToAzureNetworkMappingSettings { + #[serde(flatten)] + pub network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings, + #[serde(rename = "primaryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_location: Option, + #[serde(rename = "recoveryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureToAzureUpdateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput, + #[serde(rename = "primaryNetworkId", default, skip_serializing_if = "Option::is_none")] + pub primary_network_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureToAzureVmSyncedConfigDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "inputEndpoints", default, skip_serializing_if = "Vec::is_empty")] + pub input_endpoints: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmDiskDetails { + #[serde(rename = "vhdType", default, skip_serializing_if = "Option::is_none")] + pub vhd_type: Option, + #[serde(rename = "vhdId", default, skip_serializing_if = "Option::is_none")] + pub vhd_id: Option, + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "vhdName", default, skip_serializing_if = "Option::is_none")] + pub vhd_name: Option, + #[serde(rename = "maxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub max_size_mb: Option, + #[serde(rename = "targetDiskLocation", default, skip_serializing_if = "Option::is_none")] + pub target_disk_location: Option, + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, + #[serde(rename = "lunId", default, skip_serializing_if = "Option::is_none")] + pub lun_id: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "customTargetDiskName", default, skip_serializing_if = "Option::is_none")] + pub custom_target_disk_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ComputeSizeErrorDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationSettings { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigureAlertRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigureAlertRequestProperties { + #[serde(rename = "sendToOwners", default, skip_serializing_if = "Option::is_none")] + pub send_to_owners: Option, + #[serde(rename = "customEmailAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub custom_email_addresses: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub locale: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConsistencyCheckTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[serde(rename = "vmDetails", default, skip_serializing_if = "Vec::is_empty")] + pub vm_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateNetworkMappingInput { + pub properties: CreateNetworkMappingInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateNetworkMappingInputProperties { + #[serde(rename = "recoveryFabricName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_name: Option, + #[serde(rename = "recoveryNetworkId")] + pub recovery_network_id: String, + #[serde(rename = "fabricSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub fabric_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreatePolicyInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreatePolicyInputProperties { + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_input: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateProtectionContainerInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateProtectionContainerInputProperties { + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_input: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateProtectionContainerMappingInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateProtectionContainerMappingInputProperties { + #[serde(rename = "targetProtectionContainerId", default, skip_serializing_if = "Option::is_none")] + pub target_protection_container_id: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_input: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateProtectionIntentInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateProtectionIntentProperties { + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateProtectionIntentProviderSpecificDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateRecoveryPlanInput { + pub properties: CreateRecoveryPlanInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateRecoveryPlanInputProperties { + #[serde(rename = "primaryFabricId")] + pub primary_fabric_id: String, + #[serde(rename = "recoveryFabricId")] + pub recovery_fabric_id: String, + #[serde(rename = "failoverDeploymentModel", default, skip_serializing_if = "Option::is_none")] + pub failover_deployment_model: Option, + pub groups: Vec, + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_input: Vec, +} +pub mod create_recovery_plan_input_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FailoverDeploymentModel { + NotApplicable, + Classic, + ResourceManager, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CurrentJobDetails { + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CurrentScenarioDetails { + #[serde(rename = "scenarioName", default, skip_serializing_if = "Option::is_none")] + pub scenario_name: Option, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataStore { + #[serde(rename = "symbolicName", default, skip_serializing_if = "Option::is_none")] + pub symbolic_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[serde(rename = "freeSpace", default, skip_serializing_if = "Option::is_none")] + pub free_space: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DisableProtectionInput { + pub properties: DisableProtectionInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DisableProtectionInputProperties { + #[serde(rename = "disableProtectionReason", default, skip_serializing_if = "Option::is_none")] + pub disable_protection_reason: Option, + #[serde(rename = "replicationProviderInput", default, skip_serializing_if = "Option::is_none")] + pub replication_provider_input: Option, +} +pub mod disable_protection_input_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DisableProtectionReason { + NotSpecified, + MigrationComplete, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DisableProtectionProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiscoverProtectableItemRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiscoverProtectableItemRequestProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskDetails { + #[serde(rename = "maxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub max_size_mb: Option, + #[serde(rename = "vhdType", default, skip_serializing_if = "Option::is_none")] + pub vhd_type: Option, + #[serde(rename = "vhdId", default, skip_serializing_if = "Option::is_none")] + pub vhd_id: Option, + #[serde(rename = "vhdName", default, skip_serializing_if = "Option::is_none")] + pub vhd_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionInfo { + #[serde(rename = "diskEncryptionKeyInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_key_info: Option, + #[serde(rename = "keyEncryptionKeyInfo", default, skip_serializing_if = "Option::is_none")] + pub key_encryption_key_info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionKeyInfo { + #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub secret_identifier: Option, + #[serde(rename = "keyVaultResourceArmId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_resource_arm_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskVolumeDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DraDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[serde(rename = "forwardProtectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub forward_protected_item_count: Option, + #[serde(rename = "reverseProtectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub reverse_protected_item_count: Option, +} +pub mod dra_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableMigrationInput { + pub properties: EnableMigrationInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableMigrationInputProperties { + #[serde(rename = "policyId")] + pub policy_id: String, + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: EnableMigrationProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableMigrationProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableProtectionInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableProtectionInputProperties { + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "protectableItemId", default, skip_serializing_if = "Option::is_none")] + pub protectable_item_id: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableProtectionProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EncryptionDetails { + #[serde(rename = "kekState", default, skip_serializing_if = "Option::is_none")] + pub kek_state: Option, + #[serde(rename = "kekCertThumbprint", default, skip_serializing_if = "Option::is_none")] + pub kek_cert_thumbprint: Option, + #[serde(rename = "kekCertExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub kek_cert_expiry_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Event { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventProperties { + #[serde(rename = "eventCode", default, skip_serializing_if = "Option::is_none")] + pub event_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "eventType", default, skip_serializing_if = "Option::is_none")] + pub event_type: Option, + #[serde(rename = "affectedObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub affected_object_friendly_name: Option, + #[serde(rename = "affectedObjectCorrelationId", default, skip_serializing_if = "Option::is_none")] + pub affected_object_correlation_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[serde(rename = "timeOfOccurrence", default, skip_serializing_if = "Option::is_none")] + pub time_of_occurrence: Option, + #[serde(rename = "fabricId", default, skip_serializing_if = "Option::is_none")] + pub fabric_id: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, + #[serde(rename = "eventSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub event_specific_details: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventProviderSpecificDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventQueryParameter { + #[serde(rename = "eventCode", default, skip_serializing_if = "Option::is_none")] + pub event_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[serde(rename = "eventType", default, skip_serializing_if = "Option::is_none")] + pub event_type: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "affectedObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub affected_object_friendly_name: Option, + #[serde(rename = "affectedObjectCorrelationId", default, skip_serializing_if = "Option::is_none")] + pub affected_object_correlation_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventSpecificDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingProtectionProfile { + #[serde(flatten)] + pub protection_profile_custom_details: ProtectionProfileCustomDetails, + #[serde(rename = "protectionProfileId")] + pub protection_profile_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingRecoveryAvailabilitySet { + #[serde(flatten)] + pub recovery_availability_set_custom_details: RecoveryAvailabilitySetCustomDetails, + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingRecoveryProximityPlacementGroup { + #[serde(flatten)] + pub recovery_proximity_placement_group_custom_details: RecoveryProximityPlacementGroupCustomDetails, + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingRecoveryRecoveryResourceGroup { + #[serde(flatten)] + pub recovery_resource_group_custom_details: RecoveryResourceGroupCustomDetails, + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingRecoveryVirtualNetwork { + #[serde(flatten)] + pub recovery_virtual_network_custom_details: RecoveryVirtualNetworkCustomDetails, + #[serde(rename = "recoveryVirtualNetworkId")] + pub recovery_virtual_network_id: String, + #[serde(rename = "recoverySubnetName", default, skip_serializing_if = "Option::is_none")] + pub recovery_subnet_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingStorageAccount { + #[serde(flatten)] + pub storage_account_custom_details: StorageAccountCustomDetails, + #[serde(rename = "azureStorageAccountId")] + pub azure_storage_account_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[serde(rename = "blobUri", default, skip_serializing_if = "Option::is_none")] + pub blob_uri: Option, + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Fabric { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricCreationInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricCreationInputProperties { + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "encryptionDetails", default, skip_serializing_if = "Option::is_none")] + pub encryption_details: Option, + #[serde(rename = "rolloverEncryptionDetails", default, skip_serializing_if = "Option::is_none")] + pub rollover_encryption_details: Option, + #[serde(rename = "internalIdentifier", default, skip_serializing_if = "Option::is_none")] + pub internal_identifier: Option, + #[serde(rename = "bcdrState", default, skip_serializing_if = "Option::is_none")] + pub bcdr_state: Option, + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, + #[serde(rename = "healthErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_error_details: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricQueryParameter { + #[serde(rename = "zoneToZoneMappings", default, skip_serializing_if = "Option::is_none")] + pub zone_to_zone_mappings: Option, + #[serde(rename = "fetchAgentDetails", default, skip_serializing_if = "Option::is_none")] + pub fetch_agent_details: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricReplicationGroupTaskDetails { + #[serde(flatten)] + pub job_task_details: JobTaskDetails, + #[serde(rename = "skippedReason", default, skip_serializing_if = "Option::is_none")] + pub skipped_reason: Option, + #[serde(rename = "skippedReasonString", default, skip_serializing_if = "Option::is_none")] + pub skipped_reason_string: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricSpecificCreateNetworkMappingInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricSpecificCreationInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricSpecificDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricSpecificUpdateNetworkMappingInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailoverJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[serde(rename = "protectedItemDetails", default, skip_serializing_if = "Vec::is_empty")] + pub protected_item_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailoverProcessServerRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailoverProcessServerRequestProperties { + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "sourceProcessServerId", default, skip_serializing_if = "Option::is_none")] + pub source_process_server_id: Option, + #[serde(rename = "targetProcessServerId", default, skip_serializing_if = "Option::is_none")] + pub target_process_server_id: Option, + #[serde(rename = "vmsToMigrate", default, skip_serializing_if = "Vec::is_empty")] + pub vms_to_migrate: Vec, + #[serde(rename = "updateType", default, skip_serializing_if = "Option::is_none")] + pub update_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailoverReplicationProtectedItemDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "testVmName", default, skip_serializing_if = "Option::is_none")] + pub test_vm_name: Option, + #[serde(rename = "testVmFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub test_vm_friendly_name: Option, + #[serde(rename = "networkConnectionStatus", default, skip_serializing_if = "Option::is_none")] + pub network_connection_status: Option, + #[serde(rename = "networkFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub network_friendly_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GroupTaskDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, + #[serde(rename = "childTasks", default, skip_serializing_if = "Vec::is_empty")] + pub child_tasks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HealthError { + #[serde(rename = "innerHealthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub inner_health_errors: Vec, + #[serde(rename = "errorSource", default, skip_serializing_if = "Option::is_none")] + pub error_source: Option, + #[serde(rename = "errorType", default, skip_serializing_if = "Option::is_none")] + pub error_type: Option, + #[serde(rename = "errorLevel", default, skip_serializing_if = "Option::is_none")] + pub error_level: Option, + #[serde(rename = "errorCategory", default, skip_serializing_if = "Option::is_none")] + pub error_category: Option, + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "summaryMessage", default, skip_serializing_if = "Option::is_none")] + pub summary_message: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[serde(rename = "creationTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub creation_time_utc: Option, + #[serde(rename = "recoveryProviderErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub recovery_provider_error_message: Option, + #[serde(rename = "entityId", default, skip_serializing_if = "Option::is_none")] + pub entity_id: Option, + #[serde(rename = "errorId", default, skip_serializing_if = "Option::is_none")] + pub error_id: Option, + #[serde(rename = "customerResolvability", default, skip_serializing_if = "Option::is_none")] + pub customer_resolvability: Option, +} +pub mod health_error { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CustomerResolvability { + Allowed, + NotAllowed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HealthErrorSummary { + #[serde(rename = "summaryCode", default, skip_serializing_if = "Option::is_none")] + pub summary_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[serde(rename = "summaryMessage", default, skip_serializing_if = "Option::is_none")] + pub summary_message: Option, + #[serde(rename = "affectedResourceType", default, skip_serializing_if = "Option::is_none")] + pub affected_resource_type: Option, + #[serde(rename = "affectedResourceSubtype", default, skip_serializing_if = "Option::is_none")] + pub affected_resource_subtype: Option, + #[serde(rename = "affectedResourceCorrelationIds", default, skip_serializing_if = "Vec::is_empty")] + pub affected_resource_correlation_ids: Vec, +} +pub mod health_error_summary { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Category { + None, + Replication, + TestFailover, + Configuration, + FabricInfrastructure, + VersionExpiry, + AgentAutoUpdateInfra, + AgentAutoUpdateArtifactDeleted, + AgentAutoUpdateRunAsAccount, + AgentAutoUpdateRunAsAccountExpiry, + AgentAutoUpdateRunAsAccountExpired, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Severity { + #[serde(rename = "NONE")] + None, + Warning, + Error, + Info, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVHostDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "marsAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub mars_agent_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplica2012EventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "remoteContainerName", default, skip_serializing_if = "Option::is_none")] + pub remote_container_name: Option, + #[serde(rename = "remoteFabricName", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplica2012R2EventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "remoteContainerName", default, skip_serializing_if = "Option::is_none")] + pub remote_container_name: Option, + #[serde(rename = "remoteFabricName", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureDiskInputDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +pub mod hyper_v_replica_azure_disk_input_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[serde(rename = "hvHostVmId", default, skip_serializing_if = "Option::is_none")] + pub hv_host_vm_id: Option, + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "vhdId", default, skip_serializing_if = "Option::is_none")] + pub vhd_id: Option, + #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_account_id: Option, + #[serde(rename = "targetAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_network_id: Option, + #[serde(rename = "targetAzureSubnetId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_subnet_id: Option, + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[serde(rename = "targetAzureVmName", default, skip_serializing_if = "Option::is_none")] + pub target_azure_vm_name: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, + #[serde(rename = "targetAzureV1ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_v1_resource_group_id: Option, + #[serde(rename = "targetAzureV2ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_v2_resource_group_id: Option, + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "useManagedDisksForReplication", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks_for_replication: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "disksToIncludeForManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include_for_managed_disks: Vec, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "seedManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_tags: Option, + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +pub mod hyper_v_replica_azure_enable_protection_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "remoteContainerName", default, skip_serializing_if = "Option::is_none")] + pub remote_container_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureFailbackProviderInput { + #[serde(flatten)] + pub planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput, + #[serde(rename = "dataSyncOption", default, skip_serializing_if = "Option::is_none")] + pub data_sync_option: Option, + #[serde(rename = "recoveryVmCreationOption", default, skip_serializing_if = "Option::is_none")] + pub recovery_vm_creation_option: Option, + #[serde(rename = "providerIdForAlternateRecovery", default, skip_serializing_if = "Option::is_none")] + pub provider_id_for_alternate_recovery: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureManagedDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "seedManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_id: Option, + #[serde(rename = "replicaDiskType", default, skip_serializing_if = "Option::is_none")] + pub replica_disk_type: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzurePlannedFailoverProviderInput { + #[serde(flatten)] + pub planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput, + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzurePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "recoveryPointHistoryDurationInHours", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_duration_in_hours: Option, + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[serde(rename = "replicationInterval", default, skip_serializing_if = "Option::is_none")] + pub replication_interval: Option, + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "activeStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub active_storage_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzurePolicyInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[serde(rename = "recoveryPointHistoryDuration", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_duration: Option, + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[serde(rename = "replicationInterval", default, skip_serializing_if = "Option::is_none")] + pub replication_interval: Option, + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[serde(rename = "storageAccounts", default, skip_serializing_if = "Vec::is_empty")] + pub storage_accounts: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "azureVmDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub azure_vm_disk_details: Vec, + #[serde(rename = "recoveryAzureVmName", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_name: Option, + #[serde(rename = "recoveryAzureVMSize", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_size: Option, + #[serde(rename = "recoveryAzureStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_storage_account: Option, + #[serde(rename = "recoveryAzureLogStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_log_storage_account_id: Option, + #[serde(rename = "lastReplicatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_replicated_time: Option, + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[serde(rename = "initialReplicationDetails", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_details: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "selectedRecoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_recovery_azure_network_id: Option, + #[serde(rename = "selectedSourceNicId", default, skip_serializing_if = "Option::is_none")] + pub selected_source_nic_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[serde(rename = "oSDetails", default, skip_serializing_if = "Option::is_none")] + pub o_s_details: Option, + #[serde(rename = "sourceVmRamSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub source_vm_ram_size_in_mb: Option, + #[serde(rename = "sourceVmCpuCount", default, skip_serializing_if = "Option::is_none")] + pub source_vm_cpu_count: Option, + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[serde(rename = "recoveryAzureResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_resource_group_id: Option, + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "lastRecoveryPointReceived", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_received: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "seedManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_tags: Option, + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[serde(rename = "protectedManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_managed_disks: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[serde(rename = "hvHostVmId", default, skip_serializing_if = "Option::is_none")] + pub hv_host_vm_id: Option, + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "vHDId", default, skip_serializing_if = "Option::is_none")] + pub v_hd_id: Option, + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureTestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureUnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureUpdateReplicationProtectedItemInput { + #[serde(flatten)] + pub update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput, + #[serde(rename = "recoveryAzureV1ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_v1_resource_group_id: Option, + #[serde(rename = "recoveryAzureV2ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_v2_resource_group_id: Option, + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[serde(rename = "diskIdToDiskEncryptionMap", default, skip_serializing_if = "Option::is_none")] + pub disk_id_to_disk_encryption_map: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, +} +pub mod hyper_v_replica_azure_update_replication_protected_item_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBaseEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "remoteContainerName", default, skip_serializing_if = "Option::is_none")] + pub remote_container_name: Option, + #[serde(rename = "remoteFabricName", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBasePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "recoveryPoints", default, skip_serializing_if = "Option::is_none")] + pub recovery_points: Option, + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[serde(rename = "initialReplicationMethod", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_method: Option, + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[serde(rename = "offlineReplicationImportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_import_path: Option, + #[serde(rename = "offlineReplicationExportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_export_path: Option, + #[serde(rename = "replicationPort", default, skip_serializing_if = "Option::is_none")] + pub replication_port: Option, + #[serde(rename = "allowedAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub allowed_authentication_type: Option, + #[serde(rename = "replicaDeletionOption", default, skip_serializing_if = "Option::is_none")] + pub replica_deletion_option: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBaseReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "lastReplicatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_replicated_time: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[serde(rename = "initialReplicationDetails", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_details: Option, + #[serde(rename = "vMDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub v_m_disk_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBluePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "replicationFrequencyInSeconds", default, skip_serializing_if = "Option::is_none")] + pub replication_frequency_in_seconds: Option, + #[serde(rename = "recoveryPoints", default, skip_serializing_if = "Option::is_none")] + pub recovery_points: Option, + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[serde(rename = "initialReplicationMethod", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_method: Option, + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[serde(rename = "offlineReplicationImportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_import_path: Option, + #[serde(rename = "offlineReplicationExportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_export_path: Option, + #[serde(rename = "replicationPort", default, skip_serializing_if = "Option::is_none")] + pub replication_port: Option, + #[serde(rename = "allowedAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub allowed_authentication_type: Option, + #[serde(rename = "replicaDeletionOption", default, skip_serializing_if = "Option::is_none")] + pub replica_deletion_option: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBluePolicyInput { + #[serde(flatten)] + pub hyper_v_replica_policy_input: HyperVReplicaPolicyInput, + #[serde(rename = "replicationFrequencyInSeconds", default, skip_serializing_if = "Option::is_none")] + pub replication_frequency_in_seconds: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBlueReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "lastReplicatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_replicated_time: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[serde(rename = "initialReplicationDetails", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_details: Option, + #[serde(rename = "vMDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub v_m_disk_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "recoveryPoints", default, skip_serializing_if = "Option::is_none")] + pub recovery_points: Option, + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[serde(rename = "initialReplicationMethod", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_method: Option, + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[serde(rename = "offlineReplicationImportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_import_path: Option, + #[serde(rename = "offlineReplicationExportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_export_path: Option, + #[serde(rename = "replicationPort", default, skip_serializing_if = "Option::is_none")] + pub replication_port: Option, + #[serde(rename = "allowedAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub allowed_authentication_type: Option, + #[serde(rename = "replicaDeletionOption", default, skip_serializing_if = "Option::is_none")] + pub replica_deletion_option: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaPolicyInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[serde(rename = "recoveryPoints", default, skip_serializing_if = "Option::is_none")] + pub recovery_points: Option, + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[serde(rename = "initialReplicationMethod", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_method: Option, + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[serde(rename = "offlineReplicationImportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_import_path: Option, + #[serde(rename = "offlineReplicationExportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_export_path: Option, + #[serde(rename = "replicationPort", default, skip_serializing_if = "Option::is_none")] + pub replication_port: Option, + #[serde(rename = "allowedAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub allowed_authentication_type: Option, + #[serde(rename = "replicaDeletion", default, skip_serializing_if = "Option::is_none")] + pub replica_deletion: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "lastReplicatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_replicated_time: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[serde(rename = "initialReplicationDetails", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_details: Option, + #[serde(rename = "vMDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub v_m_disk_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVSiteDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[serde(rename = "hyperVHosts", default, skip_serializing_if = "Vec::is_empty")] + pub hyper_v_hosts: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVVirtualMachineDetails { + #[serde(flatten)] + pub configuration_settings: ConfigurationSettings, + #[serde(rename = "sourceItemId", default, skip_serializing_if = "Option::is_none")] + pub source_item_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub generation: Option, + #[serde(rename = "osDetails", default, skip_serializing_if = "Option::is_none")] + pub os_details: Option, + #[serde(rename = "diskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub disk_details: Vec, + #[serde(rename = "hasPhysicalDisk", default, skip_serializing_if = "Option::is_none")] + pub has_physical_disk: Option, + #[serde(rename = "hasFibreChannelAdapter", default, skip_serializing_if = "Option::is_none")] + pub has_fibre_channel_adapter: Option, + #[serde(rename = "hasSharedVhd", default, skip_serializing_if = "Option::is_none")] + pub has_shared_vhd: Option, + #[serde(rename = "hyperVHostId", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_host_id: Option, +} +pub mod hyper_v_virtual_machine_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HasPhysicalDisk { + Unknown, + Present, + NotPresent, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HasFibreChannelAdapter { + Unknown, + Present, + NotPresent, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HasSharedVhd { + Unknown, + Present, + NotPresent, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpConfigDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isPrimary", default, skip_serializing_if = "Option::is_none")] + pub is_primary: Option, + #[serde(rename = "subnetName", default, skip_serializing_if = "Option::is_none")] + pub subnet_name: Option, + #[serde(rename = "staticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub static_ip_address: Option, + #[serde(rename = "ipAddressType", default, skip_serializing_if = "Option::is_none")] + pub ip_address_type: Option, + #[serde(rename = "isSeletedForFailover", default, skip_serializing_if = "Option::is_none")] + pub is_seleted_for_failover: Option, + #[serde(rename = "recoverySubnetName", default, skip_serializing_if = "Option::is_none")] + pub recovery_subnet_name: Option, + #[serde(rename = "recoveryStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub recovery_static_ip_address: Option, + #[serde(rename = "recoveryIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub recovery_ip_address_type: Option, + #[serde(rename = "recoveryPublicIPAddressId", default, skip_serializing_if = "Option::is_none")] + pub recovery_public_ip_address_id: Option, + #[serde(rename = "recoveryLBBackendAddressPoolIds", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_lb_backend_address_pool_ids: Vec, + #[serde(rename = "tfoSubnetName", default, skip_serializing_if = "Option::is_none")] + pub tfo_subnet_name: Option, + #[serde(rename = "tfoStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub tfo_static_ip_address: Option, + #[serde(rename = "tfoPublicIPAddressId", default, skip_serializing_if = "Option::is_none")] + pub tfo_public_ip_address_id: Option, + #[serde(rename = "tfoLBBackendAddressPoolIds", default, skip_serializing_if = "Vec::is_empty")] + pub tfo_lb_backend_address_pool_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpConfigInputDetails { + #[serde(rename = "ipConfigName", default, skip_serializing_if = "Option::is_none")] + pub ip_config_name: Option, + #[serde(rename = "isPrimary", default, skip_serializing_if = "Option::is_none")] + pub is_primary: Option, + #[serde(rename = "isSeletedForFailover", default, skip_serializing_if = "Option::is_none")] + pub is_seleted_for_failover: Option, + #[serde(rename = "recoverySubnetName", default, skip_serializing_if = "Option::is_none")] + pub recovery_subnet_name: Option, + #[serde(rename = "recoveryStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub recovery_static_ip_address: Option, + #[serde(rename = "recoveryPublicIPAddressId", default, skip_serializing_if = "Option::is_none")] + pub recovery_public_ip_address_id: Option, + #[serde(rename = "recoveryLBBackendAddressPoolIds", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_lb_backend_address_pool_ids: Vec, + #[serde(rename = "tfoSubnetName", default, skip_serializing_if = "Option::is_none")] + pub tfo_subnet_name: Option, + #[serde(rename = "tfoStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub tfo_static_ip_address: Option, + #[serde(rename = "tfoPublicIPAddressId", default, skip_serializing_if = "Option::is_none")] + pub tfo_public_ip_address_id: Option, + #[serde(rename = "tfoLBBackendAddressPoolIds", default, skip_serializing_if = "Vec::is_empty")] + pub tfo_lb_backend_address_pool_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProviderDetails { + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "applicationId", default, skip_serializing_if = "Option::is_none")] + pub application_id: Option, + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, + #[serde(rename = "aadAuthority", default, skip_serializing_if = "Option::is_none")] + pub aad_authority: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProviderInput { + #[serde(rename = "tenantId")] + pub tenant_id: String, + #[serde(rename = "applicationId")] + pub application_id: String, + #[serde(rename = "objectId")] + pub object_id: String, + pub audience: String, + #[serde(rename = "aadAuthority")] + pub aad_authority: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAgentDetails { + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[serde(rename = "agentUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_update_status: Option, + #[serde(rename = "postUpdateRebootStatus", default, skip_serializing_if = "Option::is_none")] + pub post_update_reboot_status: Option, + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2ApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2DiskInputDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +pub mod in_mage_azure_v2_disk_input_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2EnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[serde(rename = "masterTargetId", default, skip_serializing_if = "Option::is_none")] + pub master_target_id: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, + #[serde(rename = "targetAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_network_id: Option, + #[serde(rename = "targetAzureSubnetId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_subnet_id: Option, + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[serde(rename = "targetAzureVmName", default, skip_serializing_if = "Option::is_none")] + pub target_azure_vm_name: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[serde(rename = "targetAzureV1ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_v1_resource_group_id: Option, + #[serde(rename = "targetAzureV2ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_v2_resource_group_id: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "seedManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_tags: Option, + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +pub mod in_mage_azure_v2_enable_protection_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2EventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "eventType", default, skip_serializing_if = "Option::is_none")] + pub event_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub component: Option, + #[serde(rename = "correctiveAction", default, skip_serializing_if = "Option::is_none")] + pub corrective_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub details: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub summary: Option, + #[serde(rename = "siteName", default, skip_serializing_if = "Option::is_none")] + pub site_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2ManagedDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "seedManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_id: Option, + #[serde(rename = "replicaDiskType", default, skip_serializing_if = "Option::is_none")] + pub replica_disk_type: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2PolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2PolicyInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "multiVmSyncStatus")] + pub multi_vm_sync_status: in_mage_azure_v2_policy_input::MultiVmSyncStatus, +} +pub mod in_mage_azure_v2_policy_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncStatus { + Enable, + Disable, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2ProtectedDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "protectionStage", default, skip_serializing_if = "Option::is_none")] + pub protection_stage: Option, + #[serde(rename = "healthErrorCode", default, skip_serializing_if = "Option::is_none")] + pub health_error_code: Option, + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[serde(rename = "resyncDurationInSeconds", default, skip_serializing_if = "Option::is_none")] + pub resync_duration_in_seconds: Option, + #[serde(rename = "diskCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity_in_bytes: Option, + #[serde(rename = "fileSystemCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub file_system_capacity_in_bytes: Option, + #[serde(rename = "sourceDataInMegaBytes", default, skip_serializing_if = "Option::is_none")] + pub source_data_in_mega_bytes: Option, + #[serde(rename = "psDataInMegaBytes", default, skip_serializing_if = "Option::is_none")] + pub ps_data_in_mega_bytes: Option, + #[serde(rename = "targetDataInMegaBytes", default, skip_serializing_if = "Option::is_none")] + pub target_data_in_mega_bytes: Option, + #[serde(rename = "diskResized", default, skip_serializing_if = "Option::is_none")] + pub disk_resized: Option, + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[serde(rename = "resyncProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_processed_bytes: Option, + #[serde(rename = "resyncTotalTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_total_transferred_bytes: Option, + #[serde(rename = "resyncLast15MinutesTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_last15_minutes_transferred_bytes: Option, + #[serde(rename = "resyncLastDataTransferTimeUTC", default, skip_serializing_if = "Option::is_none")] + pub resync_last_data_transfer_time_utc: Option, + #[serde(rename = "resyncStartTime", default, skip_serializing_if = "Option::is_none")] + pub resync_start_time: Option, + #[serde(rename = "progressHealth", default, skip_serializing_if = "Option::is_none")] + pub progress_health: Option, + #[serde(rename = "progressStatus", default, skip_serializing_if = "Option::is_none")] + pub progress_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2RecoveryPointDetails { + #[serde(flatten)] + pub provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails, + #[serde(rename = "isMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub is_multi_vm_sync_point: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2ReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "infrastructureVmId", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_vm_id: Option, + #[serde(rename = "vCenterInfrastructureId", default, skip_serializing_if = "Option::is_none")] + pub v_center_infrastructure_id: Option, + #[serde(rename = "protectionStage", default, skip_serializing_if = "Option::is_none")] + pub protection_stage: Option, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[serde(rename = "compressedDataRateInMB", default, skip_serializing_if = "Option::is_none")] + pub compressed_data_rate_in_mb: Option, + #[serde(rename = "uncompressedDataRateInMB", default, skip_serializing_if = "Option::is_none")] + pub uncompressed_data_rate_in_mb: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[serde(rename = "isAgentUpdateRequired", default, skip_serializing_if = "Option::is_none")] + pub is_agent_update_required: Option, + #[serde(rename = "isRebootAfterUpdateRequired", default, skip_serializing_if = "Option::is_none")] + pub is_reboot_after_update_required: Option, + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[serde(rename = "processServerName", default, skip_serializing_if = "Option::is_none")] + pub process_server_name: Option, + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[serde(rename = "diskResized", default, skip_serializing_if = "Option::is_none")] + pub disk_resized: Option, + #[serde(rename = "masterTargetId", default, skip_serializing_if = "Option::is_none")] + pub master_target_id: Option, + #[serde(rename = "sourceVmCpuCount", default, skip_serializing_if = "Option::is_none")] + pub source_vm_cpu_count: Option, + #[serde(rename = "sourceVmRamSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub source_vm_ram_size_in_mb: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "vhdName", default, skip_serializing_if = "Option::is_none")] + pub vhd_name: Option, + #[serde(rename = "osDiskId", default, skip_serializing_if = "Option::is_none")] + pub os_disk_id: Option, + #[serde(rename = "azureVMDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub azure_vm_disk_details: Vec, + #[serde(rename = "recoveryAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_name: Option, + #[serde(rename = "recoveryAzureVMSize", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_size: Option, + #[serde(rename = "recoveryAzureStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_storage_account: Option, + #[serde(rename = "recoveryAzureLogStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_log_storage_account_id: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "selectedRecoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_recovery_azure_network_id: Option, + #[serde(rename = "selectedTfoAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_tfo_azure_network_id: Option, + #[serde(rename = "selectedSourceNicId", default, skip_serializing_if = "Option::is_none")] + pub selected_source_nic_id: Option, + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datastores: Vec, + #[serde(rename = "targetVmId", default, skip_serializing_if = "Option::is_none")] + pub target_vm_id: Option, + #[serde(rename = "recoveryAzureResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_resource_group_id: Option, + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "validationErrors", default, skip_serializing_if = "Vec::is_empty")] + pub validation_errors: Vec, + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[serde(rename = "lastUpdateReceivedTime", default, skip_serializing_if = "Option::is_none")] + pub last_update_received_time: Option, + #[serde(rename = "replicaId", default, skip_serializing_if = "Option::is_none")] + pub replica_id: Option, + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[serde(rename = "protectedManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_managed_disks: Vec, + #[serde(rename = "lastRecoveryPointReceived", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_received: Option, + #[serde(rename = "firmwareType", default, skip_serializing_if = "Option::is_none")] + pub firmware_type: Option, + #[serde(rename = "azureVmGeneration", default, skip_serializing_if = "Option::is_none")] + pub azure_vm_generation: Option, + #[serde(rename = "isAdditionalStatsAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_additional_stats_available: Option, + #[serde(rename = "totalDataTransferred", default, skip_serializing_if = "Option::is_none")] + pub total_data_transferred: Option, + #[serde(rename = "totalProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub total_progress_health: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "seedManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_tags: Option, + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2ReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[serde(rename = "masterTargetId", default, skip_serializing_if = "Option::is_none")] + pub master_target_id: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2TestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2UnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2UpdateReplicationProtectedItemInput { + #[serde(flatten)] + pub update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput, + #[serde(rename = "recoveryAzureV1ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_v1_resource_group_id: Option, + #[serde(rename = "recoveryAzureV2ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_v2_resource_group_id: Option, + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, +} +pub mod in_mage_azure_v2_update_replication_protected_item_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageBasePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageDisableProtectionProviderSpecificInput { + #[serde(flatten)] + pub disable_protection_provider_specific_input: DisableProtectionProviderSpecificInput, + #[serde(rename = "replicaVmDeletionStatus", default, skip_serializing_if = "Option::is_none")] + pub replica_vm_deletion_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "diskSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_in_mb: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "diskConfiguration", default, skip_serializing_if = "Option::is_none")] + pub disk_configuration: Option, + #[serde(rename = "volumeList", default, skip_serializing_if = "Vec::is_empty")] + pub volume_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageDiskExclusionInput { + #[serde(rename = "volumeOptions", default, skip_serializing_if = "Vec::is_empty")] + pub volume_options: Vec, + #[serde(rename = "diskSignatureOptions", default, skip_serializing_if = "Vec::is_empty")] + pub disk_signature_options: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageDiskSignatureExclusionOptions { + #[serde(rename = "diskSignature", default, skip_serializing_if = "Option::is_none")] + pub disk_signature: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[serde(rename = "vmFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub vm_friendly_name: Option, + #[serde(rename = "masterTargetId")] + pub master_target_id: String, + #[serde(rename = "processServerId")] + pub process_server_id: String, + #[serde(rename = "retentionDrive")] + pub retention_drive: String, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[serde(rename = "multiVmGroupId")] + pub multi_vm_group_id: String, + #[serde(rename = "multiVmGroupName")] + pub multi_vm_group_name: String, + #[serde(rename = "datastoreName", default, skip_serializing_if = "Option::is_none")] + pub datastore_name: Option, + #[serde(rename = "diskExclusionInput", default, skip_serializing_if = "Option::is_none")] + pub disk_exclusion_input: Option, + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMagePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMagePolicyInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "multiVmSyncStatus")] + pub multi_vm_sync_status: in_mage_policy_input::MultiVmSyncStatus, +} +pub mod in_mage_policy_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncStatus { + Enable, + Disable, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageProtectedDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "protectionStage", default, skip_serializing_if = "Option::is_none")] + pub protection_stage: Option, + #[serde(rename = "healthErrorCode", default, skip_serializing_if = "Option::is_none")] + pub health_error_code: Option, + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[serde(rename = "resyncDurationInSeconds", default, skip_serializing_if = "Option::is_none")] + pub resync_duration_in_seconds: Option, + #[serde(rename = "diskCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity_in_bytes: Option, + #[serde(rename = "fileSystemCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub file_system_capacity_in_bytes: Option, + #[serde(rename = "sourceDataInMB", default, skip_serializing_if = "Option::is_none")] + pub source_data_in_mb: Option, + #[serde(rename = "psDataInMB", default, skip_serializing_if = "Option::is_none")] + pub ps_data_in_mb: Option, + #[serde(rename = "targetDataInMB", default, skip_serializing_if = "Option::is_none")] + pub target_data_in_mb: Option, + #[serde(rename = "diskResized", default, skip_serializing_if = "Option::is_none")] + pub disk_resized: Option, + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[serde(rename = "resyncProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_processed_bytes: Option, + #[serde(rename = "resyncTotalTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_total_transferred_bytes: Option, + #[serde(rename = "resyncLast15MinutesTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_last15_minutes_transferred_bytes: Option, + #[serde(rename = "resyncLastDataTransferTimeUTC", default, skip_serializing_if = "Option::is_none")] + pub resync_last_data_transfer_time_utc: Option, + #[serde(rename = "resyncStartTime", default, skip_serializing_if = "Option::is_none")] + pub resync_start_time: Option, + #[serde(rename = "progressHealth", default, skip_serializing_if = "Option::is_none")] + pub progress_health: Option, + #[serde(rename = "progressStatus", default, skip_serializing_if = "Option::is_none")] + pub progress_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmAgentUpgradeBlockingErrorDetails { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[serde(rename = "errorMessageParameters", default, skip_serializing_if = "Option::is_none")] + pub error_message_parameters: Option, + #[serde(rename = "errorTags", default, skip_serializing_if = "Option::is_none")] + pub error_tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmDiscoveredProtectedVmDetails { + #[serde(rename = "vCenterId", default, skip_serializing_if = "Option::is_none")] + pub v_center_id: Option, + #[serde(rename = "vCenterFqdn", default, skip_serializing_if = "Option::is_none")] + pub v_center_fqdn: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datastores: Vec, + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[serde(rename = "vmwareToolsStatus", default, skip_serializing_if = "Option::is_none")] + pub vmware_tools_status: Option, + #[serde(rename = "powerStatus", default, skip_serializing_if = "Option::is_none")] + pub power_status: Option, + #[serde(rename = "vmFqdn", default, skip_serializing_if = "Option::is_none")] + pub vm_fqdn: Option, + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[serde(rename = "createdTimestamp", default, skip_serializing_if = "Option::is_none")] + pub created_timestamp: Option, + #[serde(rename = "updatedTimestamp", default, skip_serializing_if = "Option::is_none")] + pub updated_timestamp: Option, + #[serde(rename = "isDeleted", default, skip_serializing_if = "Option::is_none")] + pub is_deleted: Option, + #[serde(rename = "lastDiscoveryTimeInUtc", default, skip_serializing_if = "Option::is_none")] + pub last_discovery_time_in_utc: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmDiskInput { + #[serde(rename = "diskId")] + pub disk_id: String, + #[serde(rename = "logStorageAccountId")] + pub log_storage_account_id: String, + #[serde(rename = "diskType")] + pub disk_type: in_mage_rcm_disk_input::DiskType, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +pub mod in_mage_rcm_disk_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmDisksDefaultInput { + #[serde(rename = "logStorageAccountId")] + pub log_storage_account_id: String, + #[serde(rename = "diskType")] + pub disk_type: in_mage_rcm_disks_default_input::DiskType, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +pub mod in_mage_rcm_disks_default_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[serde(rename = "fabricDiscoveryMachineId")] + pub fabric_discovery_machine_id: String, + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, + #[serde(rename = "disksDefault", default, skip_serializing_if = "Option::is_none")] + pub disks_default: Option, + #[serde(rename = "targetResourceGroupId")] + pub target_resource_group_id: String, + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[serde(rename = "processServerId")] + pub process_server_id: String, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, +} +pub mod in_mage_rcm_enable_protection_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[serde(rename = "latestAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_agent_version: Option, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[serde(rename = "applianceName", default, skip_serializing_if = "Option::is_none")] + pub appliance_name: Option, + #[serde(rename = "serverType", default, skip_serializing_if = "Option::is_none")] + pub server_type: Option, + #[serde(rename = "componentDisplayName", default, skip_serializing_if = "Option::is_none")] + pub component_display_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFabricCreationInput { + #[serde(flatten)] + pub fabric_specific_creation_input: FabricSpecificCreationInput, + #[serde(rename = "vmwareSiteId")] + pub vmware_site_id: String, + #[serde(rename = "physicalSiteId")] + pub physical_site_id: String, + #[serde(rename = "sourceAgentIdentity")] + pub source_agent_identity: IdentityProviderInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFabricSpecificDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[serde(rename = "vmwareSiteId", default, skip_serializing_if = "Option::is_none")] + pub vmware_site_id: Option, + #[serde(rename = "physicalSiteId", default, skip_serializing_if = "Option::is_none")] + pub physical_site_id: Option, + #[serde(rename = "serviceEndpoint", default, skip_serializing_if = "Option::is_none")] + pub service_endpoint: Option, + #[serde(rename = "serviceResourceId", default, skip_serializing_if = "Option::is_none")] + pub service_resource_id: Option, + #[serde(rename = "serviceContainerId", default, skip_serializing_if = "Option::is_none")] + pub service_container_id: Option, + #[serde(rename = "dataPlaneUri", default, skip_serializing_if = "Option::is_none")] + pub data_plane_uri: Option, + #[serde(rename = "controlPlaneUri", default, skip_serializing_if = "Option::is_none")] + pub control_plane_uri: Option, + #[serde(rename = "sourceAgentIdentityDetails", default, skip_serializing_if = "Option::is_none")] + pub source_agent_identity_details: Option, + #[serde(rename = "processServers", default, skip_serializing_if = "Vec::is_empty")] + pub process_servers: Vec, + #[serde(rename = "rcmProxies", default, skip_serializing_if = "Vec::is_empty")] + pub rcm_proxies: Vec, + #[serde(rename = "pushInstallers", default, skip_serializing_if = "Vec::is_empty")] + pub push_installers: Vec, + #[serde(rename = "replicationAgents", default, skip_serializing_if = "Vec::is_empty")] + pub replication_agents: Vec, + #[serde(rename = "reprotectAgents", default, skip_serializing_if = "Vec::is_empty")] + pub reprotect_agents: Vec, + #[serde(rename = "marsAgents", default, skip_serializing_if = "Vec::is_empty")] + pub mars_agents: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dras: Vec, + #[serde(rename = "agentDetails", default, skip_serializing_if = "Vec::is_empty")] + pub agent_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackDiscoveredProtectedVmDetails { + #[serde(rename = "vCenterId", default, skip_serializing_if = "Option::is_none")] + pub v_center_id: Option, + #[serde(rename = "vCenterFqdn", default, skip_serializing_if = "Option::is_none")] + pub v_center_fqdn: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datastores: Vec, + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[serde(rename = "vmwareToolsStatus", default, skip_serializing_if = "Option::is_none")] + pub vmware_tools_status: Option, + #[serde(rename = "powerStatus", default, skip_serializing_if = "Option::is_none")] + pub power_status: Option, + #[serde(rename = "vmFqdn", default, skip_serializing_if = "Option::is_none")] + pub vm_fqdn: Option, + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[serde(rename = "createdTimestamp", default, skip_serializing_if = "Option::is_none")] + pub created_timestamp: Option, + #[serde(rename = "updatedTimestamp", default, skip_serializing_if = "Option::is_none")] + pub updated_timestamp: Option, + #[serde(rename = "isDeleted", default, skip_serializing_if = "Option::is_none")] + pub is_deleted: Option, + #[serde(rename = "lastDiscoveryTimeInUtc", default, skip_serializing_if = "Option::is_none")] + pub last_discovery_time_in_utc: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[serde(rename = "applianceName", default, skip_serializing_if = "Option::is_none")] + pub appliance_name: Option, + #[serde(rename = "serverType", default, skip_serializing_if = "Option::is_none")] + pub server_type: Option, + #[serde(rename = "componentDisplayName", default, skip_serializing_if = "Option::is_none")] + pub component_display_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackMobilityAgentDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "latestVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_version: Option, + #[serde(rename = "driverVersion", default, skip_serializing_if = "Option::is_none")] + pub driver_version: Option, + #[serde(rename = "latestUpgradableVersionWithoutReboot", default, skip_serializing_if = "Option::is_none")] + pub latest_upgradable_version_without_reboot: Option, + #[serde(rename = "agentVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_version_expiry_date: Option, + #[serde(rename = "driverVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub driver_version_expiry_date: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(rename = "reasonsBlockingUpgrade", default, skip_serializing_if = "Vec::is_empty")] + pub reasons_blocking_upgrade: Vec, + #[serde(rename = "isUpgradeable", default, skip_serializing_if = "Option::is_none")] + pub is_upgradeable: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackNicDetails { + #[serde(rename = "macAddress", default, skip_serializing_if = "Option::is_none")] + pub mac_address: Option, + #[serde(rename = "networkName", default, skip_serializing_if = "Option::is_none")] + pub network_name: Option, + #[serde(rename = "adapterType", default, skip_serializing_if = "Option::is_none")] + pub adapter_type: Option, + #[serde(rename = "sourceIpAddress", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackPlannedFailoverProviderInput { + #[serde(flatten)] + pub planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput, + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: in_mage_rcm_failback_planned_failover_provider_input::RecoveryPointType, +} +pub mod in_mage_rcm_failback_planned_failover_provider_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + ApplicationConsistent, + CrashConsistent, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackProtectedDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[serde(rename = "diskUuid", default, skip_serializing_if = "Option::is_none")] + pub disk_uuid: Option, + #[serde(rename = "dataPendingInLogDataStoreInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_in_log_data_store_in_mb: Option, + #[serde(rename = "dataPendingAtSourceAgentInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_at_source_agent_in_mb: Option, + #[serde(rename = "isInitialReplicationComplete", default, skip_serializing_if = "Option::is_none")] + pub is_initial_replication_complete: Option, + #[serde(rename = "irDetails", default, skip_serializing_if = "Option::is_none")] + pub ir_details: Option, + #[serde(rename = "resyncDetails", default, skip_serializing_if = "Option::is_none")] + pub resync_details: Option, + #[serde(rename = "lastSyncTime", default, skip_serializing_if = "Option::is_none")] + pub last_sync_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "internalIdentifier", default, skip_serializing_if = "Option::is_none")] + pub internal_identifier: Option, + #[serde(rename = "azureVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub azure_virtual_machine_id: Option, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "reprotectAgentId", default, skip_serializing_if = "Option::is_none")] + pub reprotect_agent_id: Option, + #[serde(rename = "reprotectAgentName", default, skip_serializing_if = "Option::is_none")] + pub reprotect_agent_name: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[serde(rename = "targetvCenterId", default, skip_serializing_if = "Option::is_none")] + pub targetv_center_id: Option, + #[serde(rename = "targetDataStoreName", default, skip_serializing_if = "Option::is_none")] + pub target_data_store_name: Option, + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[serde(rename = "initialReplicationProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_percentage: Option, + #[serde(rename = "initialReplicationProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_processed_bytes: Option, + #[serde(rename = "initialReplicationTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_transferred_bytes: Option, + #[serde(rename = "initialReplicationProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_health: Option, + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[serde(rename = "resyncProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_processed_bytes: Option, + #[serde(rename = "resyncTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_transferred_bytes: Option, + #[serde(rename = "resyncProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_health: Option, + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[serde(rename = "resyncState", default, skip_serializing_if = "Option::is_none")] + pub resync_state: Option, + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[serde(rename = "mobilityAgentDetails", default, skip_serializing_if = "Option::is_none")] + pub mobility_agent_details: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "lastPlannedFailoverStartTime", default, skip_serializing_if = "Option::is_none")] + pub last_planned_failover_start_time: Option, + #[serde(rename = "lastPlannedFailoverStatus", default, skip_serializing_if = "Option::is_none")] + pub last_planned_failover_status: Option, + #[serde(rename = "discoveredVmDetails", default, skip_serializing_if = "Option::is_none")] + pub discovered_vm_details: Option, + #[serde(rename = "lastUsedPolicyId", default, skip_serializing_if = "Option::is_none")] + pub last_used_policy_id: Option, + #[serde(rename = "lastUsedPolicyFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub last_used_policy_friendly_name: Option, + #[serde( + rename = "isAgentRegistrationSuccessfulAfterFailover", + default, + skip_serializing_if = "Option::is_none" + )] + pub is_agent_registration_successful_after_failover: Option, +} +pub mod in_mage_rcm_failback_replication_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InitialReplicationProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncState { + None, + PreparedForResynchronization, + StartedResynchronization, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastPlannedFailoverStatus { + Succeeded, + Failed, + Cancelled, + Unknown, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[serde(rename = "processServerId")] + pub process_server_id: String, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[serde(rename = "policyId")] + pub policy_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackSyncDetails { + #[serde(rename = "progressHealth", default, skip_serializing_if = "Option::is_none")] + pub progress_health: Option, + #[serde(rename = "transferredBytes", default, skip_serializing_if = "Option::is_none")] + pub transferred_bytes: Option, + #[serde(rename = "last15MinutesTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub last15_minutes_transferred_bytes: Option, + #[serde(rename = "lastDataTransferTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_data_transfer_time_utc: Option, + #[serde(rename = "processedBytes", default, skip_serializing_if = "Option::is_none")] + pub processed_bytes: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "lastRefreshTime", default, skip_serializing_if = "Option::is_none")] + pub last_refresh_time: Option, + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, +} +pub mod in_mage_rcm_failback_sync_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + Queued, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmLastAgentUpgradeErrorDetails { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[serde(rename = "errorMessageParameters", default, skip_serializing_if = "Option::is_none")] + pub error_message_parameters: Option, + #[serde(rename = "errorTags", default, skip_serializing_if = "Option::is_none")] + pub error_tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmMobilityAgentDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "latestVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_version: Option, + #[serde(rename = "latestAgentReleaseDate", default, skip_serializing_if = "Option::is_none")] + pub latest_agent_release_date: Option, + #[serde(rename = "driverVersion", default, skip_serializing_if = "Option::is_none")] + pub driver_version: Option, + #[serde(rename = "latestUpgradableVersionWithoutReboot", default, skip_serializing_if = "Option::is_none")] + pub latest_upgradable_version_without_reboot: Option, + #[serde(rename = "agentVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_version_expiry_date: Option, + #[serde(rename = "driverVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub driver_version_expiry_date: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(rename = "reasonsBlockingUpgrade", default, skip_serializing_if = "Vec::is_empty")] + pub reasons_blocking_upgrade: Vec, + #[serde(rename = "isUpgradeable", default, skip_serializing_if = "Option::is_none")] + pub is_upgradeable: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmNicDetails { + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[serde(rename = "isPrimaryNic", default, skip_serializing_if = "Option::is_none")] + pub is_primary_nic: Option, + #[serde(rename = "isSelectedForFailover", default, skip_serializing_if = "Option::is_none")] + pub is_selected_for_failover: Option, + #[serde(rename = "sourceIPAddress", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address: Option, + #[serde(rename = "sourceIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address_type: Option, + #[serde(rename = "sourceNetworkId", default, skip_serializing_if = "Option::is_none")] + pub source_network_id: Option, + #[serde(rename = "sourceSubnetName", default, skip_serializing_if = "Option::is_none")] + pub source_subnet_name: Option, + #[serde(rename = "targetIPAddress", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address: Option, + #[serde(rename = "targetIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address_type: Option, + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[serde(rename = "testIPAddress", default, skip_serializing_if = "Option::is_none")] + pub test_ip_address: Option, + #[serde(rename = "testIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub test_ip_address_type: Option, +} +pub mod in_mage_rcm_nic_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceIpAddressType { + Dynamic, + Static, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TargetIpAddressType { + Dynamic, + Static, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TestIpAddressType { + Dynamic, + Static, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmNicInput { + #[serde(rename = "nicId")] + pub nic_id: String, + #[serde(rename = "isPrimaryNic")] + pub is_primary_nic: String, + #[serde(rename = "isSelectedForFailover", default, skip_serializing_if = "Option::is_none")] + pub is_selected_for_failover: Option, + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[serde(rename = "targetStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub target_static_ip_address: Option, + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[serde(rename = "testStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub test_static_ip_address: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[serde(rename = "recoveryPointHistoryInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_in_minutes: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "enableMultiVmSync", default, skip_serializing_if = "Option::is_none")] + pub enable_multi_vm_sync: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "recoveryPointHistoryInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_in_minutes: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[serde(rename = "enableMultiVmSync", default, skip_serializing_if = "Option::is_none")] + pub enable_multi_vm_sync: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmProtectedDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "seedManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_id: Option, + #[serde(rename = "targetManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_id: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "dataPendingInLogDataStoreInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_in_log_data_store_in_mb: Option, + #[serde(rename = "dataPendingAtSourceAgentInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_at_source_agent_in_mb: Option, + #[serde(rename = "isInitialReplicationComplete", default, skip_serializing_if = "Option::is_none")] + pub is_initial_replication_complete: Option, + #[serde(rename = "irDetails", default, skip_serializing_if = "Option::is_none")] + pub ir_details: Option, + #[serde(rename = "resyncDetails", default, skip_serializing_if = "Option::is_none")] + pub resync_details: Option, +} +pub mod in_mage_rcm_protected_disk_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmProtectionContainerMappingDetails { + #[serde(flatten)] + pub protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails, + #[serde(rename = "enableAgentAutoUpgrade", default, skip_serializing_if = "Option::is_none")] + pub enable_agent_auto_upgrade: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmRecoveryPointDetails { + #[serde(flatten)] + pub provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails, + #[serde(rename = "isMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub is_multi_vm_sync_point: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "internalIdentifier", default, skip_serializing_if = "Option::is_none")] + pub internal_identifier: Option, + #[serde(rename = "fabricDiscoveryMachineId", default, skip_serializing_if = "Option::is_none")] + pub fabric_discovery_machine_id: Option, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[serde(rename = "processorCoreCount", default, skip_serializing_if = "Option::is_none")] + pub processor_core_count: Option, + #[serde(rename = "allocatedMemoryInMB", default, skip_serializing_if = "Option::is_none")] + pub allocated_memory_in_mb: Option, + #[serde(rename = "processServerName", default, skip_serializing_if = "Option::is_none")] + pub process_server_name: Option, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "firmwareType", default, skip_serializing_if = "Option::is_none")] + pub firmware_type: Option, + #[serde(rename = "primaryNicIpAddress", default, skip_serializing_if = "Option::is_none")] + pub primary_nic_ip_address: Option, + #[serde(rename = "targetGeneration", default, skip_serializing_if = "Option::is_none")] + pub target_generation: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[serde(rename = "targetLocation", default, skip_serializing_if = "Option::is_none")] + pub target_location: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[serde(rename = "failoverRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub failover_recovery_point_id: Option, + #[serde(rename = "lastRecoveryPointReceived", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_received: Option, + #[serde(rename = "lastRpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_in_seconds: Option, + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[serde(rename = "lastRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_id: Option, + #[serde(rename = "initialReplicationProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_percentage: Option, + #[serde(rename = "initialReplicationProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_processed_bytes: Option, + #[serde(rename = "initialReplicationTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_transferred_bytes: Option, + #[serde(rename = "initialReplicationProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_health: Option, + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[serde(rename = "resyncProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_processed_bytes: Option, + #[serde(rename = "resyncTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_transferred_bytes: Option, + #[serde(rename = "resyncProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_health: Option, + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[serde(rename = "resyncState", default, skip_serializing_if = "Option::is_none")] + pub resync_state: Option, + #[serde(rename = "agentUpgradeState", default, skip_serializing_if = "Option::is_none")] + pub agent_upgrade_state: Option, + #[serde(rename = "lastAgentUpgradeType", default, skip_serializing_if = "Option::is_none")] + pub last_agent_upgrade_type: Option, + #[serde(rename = "agentUpgradeJobId", default, skip_serializing_if = "Option::is_none")] + pub agent_upgrade_job_id: Option, + #[serde(rename = "agentUpgradeAttemptToVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_upgrade_attempt_to_version: Option, + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[serde(rename = "isLastUpgradeSuccessful", default, skip_serializing_if = "Option::is_none")] + pub is_last_upgrade_successful: Option, + #[serde( + rename = "isAgentRegistrationSuccessfulAfterFailover", + default, + skip_serializing_if = "Option::is_none" + )] + pub is_agent_registration_successful_after_failover: Option, + #[serde(rename = "mobilityAgentDetails", default, skip_serializing_if = "Option::is_none")] + pub mobility_agent_details: Option, + #[serde(rename = "lastAgentUpgradeErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub last_agent_upgrade_error_details: Vec, + #[serde(rename = "agentUpgradeBlockingErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub agent_upgrade_blocking_error_details: Vec, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "discoveredVmDetails", default, skip_serializing_if = "Option::is_none")] + pub discovered_vm_details: Option, +} +pub mod in_mage_rcm_replication_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InitialReplicationProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncState { + None, + PreparedForResynchronization, + StartedResynchronization, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentUpgradeState { + None, + Started, + Completed, + Commit, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[serde(rename = "reprotectAgentId")] + pub reprotect_agent_id: String, + #[serde(rename = "datastoreName")] + pub datastore_name: String, + #[serde(rename = "logStorageAccountId")] + pub log_storage_account_id: String, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmSyncDetails { + #[serde(rename = "progressHealth", default, skip_serializing_if = "Option::is_none")] + pub progress_health: Option, + #[serde(rename = "transferredBytes", default, skip_serializing_if = "Option::is_none")] + pub transferred_bytes: Option, + #[serde(rename = "last15MinutesTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub last15_minutes_transferred_bytes: Option, + #[serde(rename = "lastDataTransferTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_data_transfer_time_utc: Option, + #[serde(rename = "processedBytes", default, skip_serializing_if = "Option::is_none")] + pub processed_bytes: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "lastRefreshTime", default, skip_serializing_if = "Option::is_none")] + pub last_refresh_time: Option, + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, +} +pub mod in_mage_rcm_sync_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + Queued, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmTestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[serde(rename = "networkId", default, skip_serializing_if = "Option::is_none")] + pub network_id: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmUnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[serde(rename = "performShutdown")] + pub perform_shutdown: String, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmUpdateApplianceForReplicationProtectedItemInput { + #[serde(flatten)] + pub update_appliance_for_replication_protected_item_provider_specific_input: + UpdateApplianceForReplicationProtectedItemProviderSpecificInput, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmUpdateContainerMappingInput { + #[serde(flatten)] + pub replication_provider_specific_update_container_mapping_input: ReplicationProviderSpecificUpdateContainerMappingInput, + #[serde(rename = "enableAgentAutoUpgrade")] + pub enable_agent_auto_upgrade: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmUpdateReplicationProtectedItemInput { + #[serde(flatten)] + pub update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput, + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, +} +pub mod in_mage_rcm_update_replication_protected_item_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[serde(rename = "activeSiteType", default, skip_serializing_if = "Option::is_none")] + pub active_site_type: Option, + #[serde(rename = "sourceVmCpuCount", default, skip_serializing_if = "Option::is_none")] + pub source_vm_cpu_count: Option, + #[serde(rename = "sourceVmRamSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub source_vm_ram_size_in_mb: Option, + #[serde(rename = "osDetails", default, skip_serializing_if = "Option::is_none")] + pub os_details: Option, + #[serde(rename = "protectionStage", default, skip_serializing_if = "Option::is_none")] + pub protection_stage: Option, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[serde(rename = "resyncDetails", default, skip_serializing_if = "Option::is_none")] + pub resync_details: Option, + #[serde(rename = "retentionWindowStart", default, skip_serializing_if = "Option::is_none")] + pub retention_window_start: Option, + #[serde(rename = "retentionWindowEnd", default, skip_serializing_if = "Option::is_none")] + pub retention_window_end: Option, + #[serde(rename = "compressedDataRateInMB", default, skip_serializing_if = "Option::is_none")] + pub compressed_data_rate_in_mb: Option, + #[serde(rename = "uncompressedDataRateInMB", default, skip_serializing_if = "Option::is_none")] + pub uncompressed_data_rate_in_mb: Option, + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[serde(rename = "masterTargetId", default, skip_serializing_if = "Option::is_none")] + pub master_target_id: Option, + #[serde(rename = "consistencyPoints", default, skip_serializing_if = "Option::is_none")] + pub consistency_points: Option, + #[serde(rename = "diskResized", default, skip_serializing_if = "Option::is_none")] + pub disk_resized: Option, + #[serde(rename = "rebootAfterUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub reboot_after_update_status: Option, + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, + #[serde(rename = "agentDetails", default, skip_serializing_if = "Option::is_none")] + pub agent_details: Option, + #[serde(rename = "vCenterInfrastructureId", default, skip_serializing_if = "Option::is_none")] + pub v_center_infrastructure_id: Option, + #[serde(rename = "infrastructureVmId", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_vm_id: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[serde(rename = "azureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub azure_storage_account_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datastores: Vec, + #[serde(rename = "validationErrors", default, skip_serializing_if = "Vec::is_empty")] + pub validation_errors: Vec, + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[serde(rename = "lastUpdateReceivedTime", default, skip_serializing_if = "Option::is_none")] + pub last_update_received_time: Option, + #[serde(rename = "replicaId", default, skip_serializing_if = "Option::is_none")] + pub replica_id: Option, + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[serde(rename = "isAdditionalStatsAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_additional_stats_available: Option, + #[serde(rename = "totalDataTransferred", default, skip_serializing_if = "Option::is_none")] + pub total_data_transferred: Option, + #[serde(rename = "totalProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub total_progress_health: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[serde(rename = "masterTargetId")] + pub master_target_id: String, + #[serde(rename = "processServerId")] + pub process_server_id: String, + #[serde(rename = "retentionDrive")] + pub retention_drive: String, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[serde(rename = "datastoreName", default, skip_serializing_if = "Option::is_none")] + pub datastore_name: Option, + #[serde(rename = "diskExclusionInput", default, skip_serializing_if = "Option::is_none")] + pub disk_exclusion_input: Option, + #[serde(rename = "profileId")] + pub profile_id: String, + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageTestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +pub mod in_mage_test_failover_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + LatestTime, + LatestTag, + Custom, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageUnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +pub mod in_mage_unplanned_failover_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + LatestTime, + LatestTag, + Custom, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageVolumeExclusionOptions { + #[serde(rename = "volumeLabel", default, skip_serializing_if = "Option::is_none")] + pub volume_label: Option, + #[serde(rename = "onlyExcludeIfSingleVolume", default, skip_serializing_if = "Option::is_none")] + pub only_exclude_if_single_volume: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InconsistentVmDetails { + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[serde(rename = "cloudName", default, skip_serializing_if = "Option::is_none")] + pub cloud_name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "errorIds", default, skip_serializing_if = "Vec::is_empty")] + pub error_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InitialReplicationDetails { + #[serde(rename = "initialReplicationType", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_type: Option, + #[serde(rename = "initialReplicationProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_percentage: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InlineWorkflowTaskDetails { + #[serde(flatten)] + pub group_task_details: GroupTaskDetails, + #[serde(rename = "workflowIds", default, skip_serializing_if = "Vec::is_empty")] + pub workflow_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InnerHealthError { + #[serde(rename = "errorSource", default, skip_serializing_if = "Option::is_none")] + pub error_source: Option, + #[serde(rename = "errorType", default, skip_serializing_if = "Option::is_none")] + pub error_type: Option, + #[serde(rename = "errorLevel", default, skip_serializing_if = "Option::is_none")] + pub error_level: Option, + #[serde(rename = "errorCategory", default, skip_serializing_if = "Option::is_none")] + pub error_category: Option, + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "summaryMessage", default, skip_serializing_if = "Option::is_none")] + pub summary_message: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[serde(rename = "creationTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub creation_time_utc: Option, + #[serde(rename = "recoveryProviderErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub recovery_provider_error_message: Option, + #[serde(rename = "entityId", default, skip_serializing_if = "Option::is_none")] + pub entity_id: Option, + #[serde(rename = "errorId", default, skip_serializing_if = "Option::is_none")] + pub error_id: Option, + #[serde(rename = "customerResolvability", default, skip_serializing_if = "Option::is_none")] + pub customer_resolvability: Option, +} +pub mod inner_health_error { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CustomerResolvability { + Allowed, + NotAllowed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InputEndpoint { + #[serde(rename = "endpointName", default, skip_serializing_if = "Option::is_none")] + pub endpoint_name: Option, + #[serde(rename = "privatePort", default, skip_serializing_if = "Option::is_none")] + pub private_port: Option, + #[serde(rename = "publicPort", default, skip_serializing_if = "Option::is_none")] + pub public_port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Job { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, + #[serde(rename = "affectedObjectDetails", default, skip_serializing_if = "Option::is_none")] + pub affected_object_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobEntity { + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "jobFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub job_friendly_name: Option, + #[serde(rename = "targetObjectId", default, skip_serializing_if = "Option::is_none")] + pub target_object_id: Option, + #[serde(rename = "targetObjectName", default, skip_serializing_if = "Option::is_none")] + pub target_object_name: Option, + #[serde(rename = "targetInstanceType", default, skip_serializing_if = "Option::is_none")] + pub target_instance_type: Option, + #[serde(rename = "jobScenarioName", default, skip_serializing_if = "Option::is_none")] + pub job_scenario_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobErrorDetails { + #[serde(rename = "serviceErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub service_error_details: Option, + #[serde(rename = "providerErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_error_details: Option, + #[serde(rename = "errorLevel", default, skip_serializing_if = "Option::is_none")] + pub error_level: Option, + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobProperties { + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, + #[serde(rename = "scenarioName", default, skip_serializing_if = "Option::is_none")] + pub scenario_name: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "stateDescription", default, skip_serializing_if = "Option::is_none")] + pub state_description: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tasks: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "allowedActions", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_actions: Vec, + #[serde(rename = "targetObjectId", default, skip_serializing_if = "Option::is_none")] + pub target_object_id: Option, + #[serde(rename = "targetObjectName", default, skip_serializing_if = "Option::is_none")] + pub target_object_name: Option, + #[serde(rename = "targetInstanceType", default, skip_serializing_if = "Option::is_none")] + pub target_instance_type: Option, + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobQueryParameter { + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "fabricId", default, skip_serializing_if = "Option::is_none")] + pub fabric_id: Option, + #[serde(rename = "affectedObjectTypes", default, skip_serializing_if = "Option::is_none")] + pub affected_object_types: Option, + #[serde(rename = "jobStatus", default, skip_serializing_if = "Option::is_none")] + pub job_status: Option, + #[serde(rename = "jobOutputType", default, skip_serializing_if = "Option::is_none")] + pub job_output_type: Option, + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, + #[serde(rename = "timezoneOffset", default, skip_serializing_if = "Option::is_none")] + pub timezone_offset: Option, +} +pub mod job_query_parameter { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum JobOutputType { + Json, + Xml, + Excel, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusEventDetails { + #[serde(flatten)] + pub event_specific_details: EventSpecificDetails, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "jobFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub job_friendly_name: Option, + #[serde(rename = "jobStatus", default, skip_serializing_if = "Option::is_none")] + pub job_status: Option, + #[serde(rename = "affectedObjectType", default, skip_serializing_if = "Option::is_none")] + pub affected_object_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[serde(rename = "jobTask", default, skip_serializing_if = "Option::is_none")] + pub job_task: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyEncryptionKeyInfo { + #[serde(rename = "keyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub key_identifier: Option, + #[serde(rename = "keyVaultResourceArmId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_resource_arm_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogicalNetwork { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogicalNetworkCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogicalNetworkProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "networkVirtualizationStatus", default, skip_serializing_if = "Option::is_none")] + pub network_virtualization_status: Option, + #[serde(rename = "logicalNetworkUsage", default, skip_serializing_if = "Option::is_none")] + pub logical_network_usage: Option, + #[serde(rename = "logicalNetworkDefinitionsStatus", default, skip_serializing_if = "Option::is_none")] + pub logical_network_definitions_status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManualActionTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub instructions: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub observation: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MarsAgentDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +pub mod mars_agent_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MasterTargetServer { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[serde(rename = "versionStatus", default, skip_serializing_if = "Option::is_none")] + pub version_status: Option, + #[serde(rename = "retentionVolumes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_volumes: Vec, + #[serde(rename = "dataStores", default, skip_serializing_if = "Vec::is_empty")] + pub data_stores: Vec, + #[serde(rename = "validationErrors", default, skip_serializing_if = "Vec::is_empty")] + pub validation_errors: Vec, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[serde(rename = "diskCount", default, skip_serializing_if = "Option::is_none")] + pub disk_count: Option, + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[serde(rename = "marsAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub mars_agent_version: Option, + #[serde(rename = "marsAgentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub mars_agent_expiry_date: Option, + #[serde(rename = "agentVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub agent_version_details: Option, + #[serde(rename = "marsAgentVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub mars_agent_version_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrateInput { + pub properties: MigrateInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrateInputProperties { + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: MigrateProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrateProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationItem { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationItemCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationItemProperties { + #[serde(rename = "machineName", default, skip_serializing_if = "Option::is_none")] + pub machine_name: Option, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "policyFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub policy_friendly_name: Option, + #[serde(rename = "migrationState", default, skip_serializing_if = "Option::is_none")] + pub migration_state: Option, + #[serde(rename = "migrationStateDescription", default, skip_serializing_if = "Option::is_none")] + pub migration_state_description: Option, + #[serde(rename = "lastTestMigrationTime", default, skip_serializing_if = "Option::is_none")] + pub last_test_migration_time: Option, + #[serde(rename = "lastTestMigrationStatus", default, skip_serializing_if = "Option::is_none")] + pub last_test_migration_status: Option, + #[serde(rename = "testMigrateState", default, skip_serializing_if = "Option::is_none")] + pub test_migrate_state: Option, + #[serde(rename = "testMigrateStateDescription", default, skip_serializing_if = "Option::is_none")] + pub test_migrate_state_description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[serde(rename = "allowedOperations", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_operations: Vec, + #[serde(rename = "currentJob", default, skip_serializing_if = "Option::is_none")] + pub current_job: Option, + #[serde(rename = "eventCorrelationId", default, skip_serializing_if = "Option::is_none")] + pub event_correlation_id: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +pub mod migration_item_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MigrationState { + None, + EnableMigrationInProgress, + EnableMigrationFailed, + DisableMigrationInProgress, + DisableMigrationFailed, + InitialSeedingInProgress, + InitialSeedingFailed, + Replicating, + MigrationInProgress, + MigrationSucceeded, + MigrationFailed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TestMigrateState { + None, + TestMigrationInProgress, + TestMigrationSucceeded, + TestMigrationFailed, + TestMigrationCleanupInProgress, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationItemsQueryParameter { + #[serde(rename = "sourceFabricName", default, skip_serializing_if = "Option::is_none")] + pub source_fabric_name: Option, + #[serde(rename = "sourceContainerName", default, skip_serializing_if = "Option::is_none")] + pub source_container_name: Option, + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationProviderSpecificSettings { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationRecoveryPoint { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationRecoveryPointCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationRecoveryPointProperties { + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, +} +pub mod migration_recovery_point_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + NotSpecified, + ApplicationConsistent, + CrashConsistent, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MobilityServiceUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "rebootStatus", default, skip_serializing_if = "Option::is_none")] + pub reboot_status: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Network { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkMapping { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkMappingCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkMappingFabricSpecificSettings { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkMappingProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "primaryNetworkFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub primary_network_friendly_name: Option, + #[serde(rename = "primaryNetworkId", default, skip_serializing_if = "Option::is_none")] + pub primary_network_id: Option, + #[serde(rename = "primaryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_friendly_name: Option, + #[serde(rename = "recoveryNetworkFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_friendly_name: Option, + #[serde(rename = "recoveryNetworkId", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_id: Option, + #[serde(rename = "recoveryFabricArmId", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_arm_id: Option, + #[serde(rename = "recoveryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_friendly_name: Option, + #[serde(rename = "fabricSpecificSettings", default, skip_serializing_if = "Option::is_none")] + pub fabric_specific_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkProperties { + #[serde(rename = "fabricType", default, skip_serializing_if = "Option::is_none")] + pub fabric_type: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subnets: Vec, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "networkType", default, skip_serializing_if = "Option::is_none")] + pub network_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NewProtectionProfile { + #[serde(flatten)] + pub protection_profile_custom_details: ProtectionProfileCustomDetails, + #[serde(rename = "policyName")] + pub policy_name: String, + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "multiVmSyncStatus")] + pub multi_vm_sync_status: new_protection_profile::MultiVmSyncStatus, +} +pub mod new_protection_profile { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncStatus { + Enable, + Disable, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NewRecoveryVirtualNetwork { + #[serde(flatten)] + pub recovery_virtual_network_custom_details: RecoveryVirtualNetworkCustomDetails, + #[serde( + rename = "recoveryVirtualNetworkResourceGroupName", + default, + skip_serializing_if = "Option::is_none" + )] + pub recovery_virtual_network_resource_group_name: Option, + #[serde(rename = "recoveryVirtualNetworkName", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_network_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsDetails { + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "productType", default, skip_serializing_if = "Option::is_none")] + pub product_type: Option, + #[serde(rename = "osEdition", default, skip_serializing_if = "Option::is_none")] + pub os_edition: Option, + #[serde(rename = "oSVersion", default, skip_serializing_if = "Option::is_none")] + pub o_s_version: Option, + #[serde(rename = "oSMajorVersion", default, skip_serializing_if = "Option::is_none")] + pub o_s_major_version: Option, + #[serde(rename = "oSMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub o_s_minor_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsDiskDetails { + #[serde(rename = "osVhdId", default, skip_serializing_if = "Option::is_none")] + pub os_vhd_id: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "vhdName", default, skip_serializing_if = "Option::is_none")] + pub vhd_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsVersionWrapper { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "servicePack", default, skip_serializing_if = "Option::is_none")] + pub service_pack: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsDiscovery { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsDiscoveryCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsDiscoveryProperties {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PlannedFailoverInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PlannedFailoverInputProperties { + #[serde(rename = "failoverDirection", default, skip_serializing_if = "Option::is_none")] + pub failover_direction: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PlannedFailoverProviderSpecificFailoverInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Policy { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyProviderSpecificDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProcessServer { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[serde(rename = "versionStatus", default, skip_serializing_if = "Option::is_none")] + pub version_status: Option, + #[serde(rename = "mobilityServiceUpdates", default, skip_serializing_if = "Vec::is_empty")] + pub mobility_service_updates: Vec, + #[serde(rename = "hostId", default, skip_serializing_if = "Option::is_none")] + pub host_id: Option, + #[serde(rename = "machineCount", default, skip_serializing_if = "Option::is_none")] + pub machine_count: Option, + #[serde(rename = "replicationPairCount", default, skip_serializing_if = "Option::is_none")] + pub replication_pair_count: Option, + #[serde(rename = "systemLoad", default, skip_serializing_if = "Option::is_none")] + pub system_load: Option, + #[serde(rename = "systemLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub system_load_status: Option, + #[serde(rename = "cpuLoad", default, skip_serializing_if = "Option::is_none")] + pub cpu_load: Option, + #[serde(rename = "cpuLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub cpu_load_status: Option, + #[serde(rename = "totalMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_memory_in_bytes: Option, + #[serde(rename = "availableMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_memory_in_bytes: Option, + #[serde(rename = "memoryUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub memory_usage_status: Option, + #[serde(rename = "totalSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_space_in_bytes: Option, + #[serde(rename = "availableSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_space_in_bytes: Option, + #[serde(rename = "spaceUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub space_usage_status: Option, + #[serde(rename = "psServiceStatus", default, skip_serializing_if = "Option::is_none")] + pub ps_service_status: Option, + #[serde(rename = "sslCertExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub ssl_cert_expiry_date: Option, + #[serde(rename = "sslCertExpiryRemainingDays", default, skip_serializing_if = "Option::is_none")] + pub ssl_cert_expiry_remaining_days: Option, + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[serde(rename = "agentVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub agent_version_details: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "psStatsRefreshTime", default, skip_serializing_if = "Option::is_none")] + pub ps_stats_refresh_time: Option, + #[serde(rename = "throughputUploadPendingDataInBytes", default, skip_serializing_if = "Option::is_none")] + pub throughput_upload_pending_data_in_bytes: Option, + #[serde(rename = "throughputInMBps", default, skip_serializing_if = "Option::is_none")] + pub throughput_in_m_bps: Option, + #[serde(rename = "throughputInBytes", default, skip_serializing_if = "Option::is_none")] + pub throughput_in_bytes: Option, + #[serde(rename = "throughputStatus", default, skip_serializing_if = "Option::is_none")] + pub throughput_status: Option, + #[serde(rename = "marsCommunicationStatus", default, skip_serializing_if = "Option::is_none")] + pub mars_communication_status: Option, + #[serde(rename = "marsRegistrationStatus", default, skip_serializing_if = "Option::is_none")] + pub mars_registration_status: Option, +} +pub mod process_server { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProcessServerDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(rename = "totalMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_memory_in_bytes: Option, + #[serde(rename = "availableMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_memory_in_bytes: Option, + #[serde(rename = "usedMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub used_memory_in_bytes: Option, + #[serde(rename = "memoryUsagePercentage", default, skip_serializing_if = "Option::is_none")] + pub memory_usage_percentage: Option, + #[serde(rename = "totalSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_space_in_bytes: Option, + #[serde(rename = "availableSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_space_in_bytes: Option, + #[serde(rename = "usedSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub used_space_in_bytes: Option, + #[serde(rename = "freeSpacePercentage", default, skip_serializing_if = "Option::is_none")] + pub free_space_percentage: Option, + #[serde(rename = "throughputUploadPendingDataInBytes", default, skip_serializing_if = "Option::is_none")] + pub throughput_upload_pending_data_in_bytes: Option, + #[serde(rename = "throughputInBytes", default, skip_serializing_if = "Option::is_none")] + pub throughput_in_bytes: Option, + #[serde(rename = "processorUsagePercentage", default, skip_serializing_if = "Option::is_none")] + pub processor_usage_percentage: Option, + #[serde(rename = "throughputStatus", default, skip_serializing_if = "Option::is_none")] + pub throughput_status: Option, + #[serde(rename = "systemLoad", default, skip_serializing_if = "Option::is_none")] + pub system_load: Option, + #[serde(rename = "systemLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub system_load_status: Option, + #[serde(rename = "diskUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub disk_usage_status: Option, + #[serde(rename = "memoryUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub memory_usage_status: Option, + #[serde(rename = "processorUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub processor_usage_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[serde(rename = "historicHealth", default, skip_serializing_if = "Option::is_none")] + pub historic_health: Option, +} +pub mod process_server_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ThroughputStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SystemLoadStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskUsageStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MemoryUsageStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProcessorUsageStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HistoricHealth { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectableItem { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectableItemCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectableItemProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[serde(rename = "replicationProtectedItemId", default, skip_serializing_if = "Option::is_none")] + pub replication_protected_item_id: Option, + #[serde(rename = "recoveryServicesProviderId", default, skip_serializing_if = "Option::is_none")] + pub recovery_services_provider_id: Option, + #[serde(rename = "protectionReadinessErrors", default, skip_serializing_if = "Vec::is_empty")] + pub protection_readiness_errors: Vec, + #[serde(rename = "supportedReplicationProviders", default, skip_serializing_if = "Vec::is_empty")] + pub supported_replication_providers: Vec, + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectableItemQueryParameter { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItemsQueryParameter { + #[serde(rename = "sourceFabricName", default, skip_serializing_if = "Option::is_none")] + pub source_fabric_name: Option, + #[serde(rename = "recoveryPlanName", default, skip_serializing_if = "Option::is_none")] + pub recovery_plan_name: Option, + #[serde(rename = "sourceFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub source_fabric_location: Option, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(rename = "vCenterName", default, skip_serializing_if = "Option::is_none")] + pub v_center_name: Option, + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, + #[serde(rename = "multiVmGroupCreateOption", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_create_option: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, +} +pub mod protected_items_query_parameter { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmGroupCreateOption { + AutoCreated, + UserSpecified, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainer { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerFabricSpecificDetails { + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerMapping { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerMappingCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerMappingProperties { + #[serde(rename = "targetProtectionContainerId", default, skip_serializing_if = "Option::is_none")] + pub target_protection_container_id: Option, + #[serde(rename = "targetProtectionContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub target_protection_container_friendly_name: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_error_details: Vec, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "sourceProtectionContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub source_protection_container_friendly_name: Option, + #[serde(rename = "sourceFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub source_fabric_friendly_name: Option, + #[serde(rename = "targetFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub target_fabric_friendly_name: Option, + #[serde(rename = "policyFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub policy_friendly_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerMappingProviderSpecificDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerProperties { + #[serde(rename = "fabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub fabric_friendly_name: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "fabricType", default, skip_serializing_if = "Option::is_none")] + pub fabric_type: Option, + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[serde(rename = "pairingStatus", default, skip_serializing_if = "Option::is_none")] + pub pairing_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub role: Option, + #[serde(rename = "fabricSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub fabric_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionProfileCustomDetails { + #[serde(rename = "resourceType")] + pub resource_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProviderError { + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(rename = "errorId", default, skip_serializing_if = "Option::is_none")] + pub error_id: Option, + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProviderSpecificRecoveryPointDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PushInstallerDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +pub mod push_installer_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RcmProxyDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "clientAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub client_authentication_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +pub mod rcm_proxy_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryAvailabilitySetCustomDetails { + #[serde(rename = "resourceType")] + pub resource_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlan { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanA2aDetails { + #[serde(flatten)] + pub recovery_plan_provider_specific_details: RecoveryPlanProviderSpecificDetails, + #[serde(rename = "primaryZone", default, skip_serializing_if = "Option::is_none")] + pub primary_zone: Option, + #[serde(rename = "recoveryZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_zone: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanA2aFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_a2a_failover_input::RecoveryPointType, + #[serde(rename = "cloudServiceCreationOption", default, skip_serializing_if = "Option::is_none")] + pub cloud_service_creation_option: Option, + #[serde(rename = "multiVmSyncPointOption", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_point_option: Option, +} +pub mod recovery_plan_a2a_failover_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + Latest, + LatestApplicationConsistent, + LatestCrashConsistent, + LatestProcessed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncPointOption { + UseMultiVmSyncRecoveryPoint, + UsePerVmRecoveryPoint, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanA2aInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_input: RecoveryPlanProviderSpecificInput, + #[serde(rename = "primaryZone", default, skip_serializing_if = "Option::is_none")] + pub primary_zone: Option, + #[serde(rename = "recoveryZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_zone: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanAction { + #[serde(rename = "actionName")] + pub action_name: String, + #[serde(rename = "failoverTypes")] + pub failover_types: Vec, + #[serde(rename = "failoverDirections")] + pub failover_directions: Vec, + #[serde(rename = "customDetails")] + pub custom_details: RecoveryPlanActionDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanActionDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanAutomationRunbookActionDetails { + #[serde(flatten)] + pub recovery_plan_action_details: RecoveryPlanActionDetails, + #[serde(rename = "runbookId", default, skip_serializing_if = "Option::is_none")] + pub runbook_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[serde(rename = "fabricLocation")] + pub fabric_location: recovery_plan_automation_runbook_action_details::FabricLocation, +} +pub mod recovery_plan_automation_runbook_action_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FabricLocation { + Primary, + Recovery, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanGroup { + #[serde(rename = "groupType")] + pub group_type: recovery_plan_group::GroupType, + #[serde(rename = "replicationProtectedItems", default, skip_serializing_if = "Vec::is_empty")] + pub replication_protected_items: Vec, + #[serde(rename = "startGroupActions", default, skip_serializing_if = "Vec::is_empty")] + pub start_group_actions: Vec, + #[serde(rename = "endGroupActions", default, skip_serializing_if = "Vec::is_empty")] + pub end_group_actions: Vec, +} +pub mod recovery_plan_group { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum GroupType { + Shutdown, + Boot, + Failover, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanGroupTaskDetails { + #[serde(flatten)] + pub group_task_details: GroupTaskDetails, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "rpGroupType", default, skip_serializing_if = "Option::is_none")] + pub rp_group_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanHyperVReplicaAzureFailbackInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[serde(rename = "dataSyncOption")] + pub data_sync_option: recovery_plan_hyper_v_replica_azure_failback_input::DataSyncOption, + #[serde(rename = "recoveryVmCreationOption")] + pub recovery_vm_creation_option: recovery_plan_hyper_v_replica_azure_failback_input::RecoveryVmCreationOption, +} +pub mod recovery_plan_hyper_v_replica_azure_failback_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataSyncOption { + ForDownTime, + ForSynchronization, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryVmCreationOption { + CreateVmIfNotFound, + NoAction, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanHyperVReplicaAzureFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, +} +pub mod recovery_plan_hyper_v_replica_azure_failover_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + Latest, + LatestApplicationConsistent, + LatestProcessed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanInMageAzureV2FailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_in_mage_azure_v2_failover_input::RecoveryPointType, + #[serde(rename = "useMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub use_multi_vm_sync_point: Option, +} +pub mod recovery_plan_in_mage_azure_v2_failover_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + Latest, + LatestApplicationConsistent, + LatestCrashConsistent, + LatestProcessed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanInMageFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_in_mage_failover_input::RecoveryPointType, +} +pub mod recovery_plan_in_mage_failover_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + LatestTime, + LatestTag, + Custom, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanInMageRcmFailbackFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_in_mage_rcm_failback_failover_input::RecoveryPointType, + #[serde(rename = "useMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub use_multi_vm_sync_point: Option, +} +pub mod recovery_plan_in_mage_rcm_failback_failover_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + ApplicationConsistent, + CrashConsistent, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanInMageRcmFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_in_mage_rcm_failover_input::RecoveryPointType, + #[serde(rename = "useMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub use_multi_vm_sync_point: Option, +} +pub mod recovery_plan_in_mage_rcm_failover_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + Latest, + LatestApplicationConsistent, + LatestCrashConsistent, + LatestProcessed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanManualActionDetails { + #[serde(flatten)] + pub recovery_plan_action_details: RecoveryPlanActionDetails, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanPlannedFailoverInput { + pub properties: RecoveryPlanPlannedFailoverInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanPlannedFailoverInputProperties { + #[serde(rename = "failoverDirection")] + pub failover_direction: recovery_plan_planned_failover_input_properties::FailoverDirection, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_details: Vec, +} +pub mod recovery_plan_planned_failover_input_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FailoverDirection { + PrimaryToRecovery, + RecoveryToPrimary, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "primaryFabricId", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_id: Option, + #[serde(rename = "primaryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_friendly_name: Option, + #[serde(rename = "recoveryFabricId", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_id: Option, + #[serde(rename = "recoveryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_friendly_name: Option, + #[serde(rename = "failoverDeploymentModel", default, skip_serializing_if = "Option::is_none")] + pub failover_deployment_model: Option, + #[serde(rename = "replicationProviders", default, skip_serializing_if = "Vec::is_empty")] + pub replication_providers: Vec, + #[serde(rename = "allowedOperations", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_operations: Vec, + #[serde(rename = "lastPlannedFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_planned_failover_time: Option, + #[serde(rename = "lastUnplannedFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_unplanned_failover_time: Option, + #[serde(rename = "lastTestFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_test_failover_time: Option, + #[serde(rename = "currentScenario", default, skip_serializing_if = "Option::is_none")] + pub current_scenario: Option, + #[serde(rename = "currentScenarioStatus", default, skip_serializing_if = "Option::is_none")] + pub current_scenario_status: Option, + #[serde(rename = "currentScenarioStatusDescription", default, skip_serializing_if = "Option::is_none")] + pub current_scenario_status_description: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub groups: Vec, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanProtectedItem { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanProviderSpecificDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanProviderSpecificFailoverInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanScriptActionDetails { + #[serde(flatten)] + pub recovery_plan_action_details: RecoveryPlanActionDetails, + pub path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[serde(rename = "fabricLocation")] + pub fabric_location: recovery_plan_script_action_details::FabricLocation, +} +pub mod recovery_plan_script_action_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FabricLocation { + Primary, + Recovery, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanShutdownGroupTaskDetails { + #[serde(flatten)] + pub recovery_plan_group_task_details: RecoveryPlanGroupTaskDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanTestFailoverCleanupInput { + pub properties: RecoveryPlanTestFailoverCleanupInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanTestFailoverCleanupInputProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanTestFailoverInput { + pub properties: RecoveryPlanTestFailoverInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanTestFailoverInputProperties { + #[serde(rename = "failoverDirection")] + pub failover_direction: recovery_plan_test_failover_input_properties::FailoverDirection, + #[serde(rename = "networkType")] + pub network_type: String, + #[serde(rename = "networkId", default, skip_serializing_if = "Option::is_none")] + pub network_id: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_details: Vec, +} +pub mod recovery_plan_test_failover_input_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FailoverDirection { + PrimaryToRecovery, + RecoveryToPrimary, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanUnplannedFailoverInput { + pub properties: RecoveryPlanUnplannedFailoverInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanUnplannedFailoverInputProperties { + #[serde(rename = "failoverDirection")] + pub failover_direction: recovery_plan_unplanned_failover_input_properties::FailoverDirection, + #[serde(rename = "sourceSiteOperations")] + pub source_site_operations: recovery_plan_unplanned_failover_input_properties::SourceSiteOperations, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_details: Vec, +} +pub mod recovery_plan_unplanned_failover_input_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FailoverDirection { + PrimaryToRecovery, + RecoveryToPrimary, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceSiteOperations { + Required, + NotRequired, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPoint { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPointProperties { + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryProximityPlacementGroupCustomDetails { + #[serde(rename = "resourceType")] + pub resource_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryResourceGroupCustomDetails { + #[serde(rename = "resourceType")] + pub resource_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryServicesProvider { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryServicesProviderCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryServicesProviderProperties { + #[serde(rename = "fabricType", default, skip_serializing_if = "Option::is_none")] + pub fabric_type: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "providerVersion", default, skip_serializing_if = "Option::is_none")] + pub provider_version: Option, + #[serde(rename = "serverVersion", default, skip_serializing_if = "Option::is_none")] + pub server_version: Option, + #[serde(rename = "providerVersionState", default, skip_serializing_if = "Option::is_none")] + pub provider_version_state: Option, + #[serde(rename = "providerVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub provider_version_expiry_date: Option, + #[serde(rename = "fabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub fabric_friendly_name: Option, + #[serde(rename = "lastHeartBeat", default, skip_serializing_if = "Option::is_none")] + pub last_heart_beat: Option, + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[serde(rename = "allowedScenarios", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_scenarios: Vec, + #[serde(rename = "healthErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_error_details: Vec, + #[serde(rename = "draIdentifier", default, skip_serializing_if = "Option::is_none")] + pub dra_identifier: Option, + #[serde(rename = "machineId", default, skip_serializing_if = "Option::is_none")] + pub machine_id: Option, + #[serde(rename = "machineName", default, skip_serializing_if = "Option::is_none")] + pub machine_name: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(rename = "authenticationIdentityDetails", default, skip_serializing_if = "Option::is_none")] + pub authentication_identity_details: Option, + #[serde(rename = "resourceAccessIdentityDetails", default, skip_serializing_if = "Option::is_none")] + pub resource_access_identity_details: Option, + #[serde( + rename = "dataPlaneAuthenticationIdentityDetails", + default, + skip_serializing_if = "Option::is_none" + )] + pub data_plane_authentication_identity_details: Option, + #[serde(rename = "providerVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_version_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryVirtualNetworkCustomDetails { + #[serde(rename = "resourceType")] + pub resource_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RemoveDisksInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RemoveDisksInputProperties { + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RemoveDisksProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RemoveProtectionContainerMappingInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RemoveProtectionContainerMappingInputProperties { + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_input: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RenewCertificateInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RenewCertificateInputProperties { + #[serde(rename = "renewCertificateType", default, skip_serializing_if = "Option::is_none")] + pub renew_certificate_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationAgentDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +pub mod replication_agent_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationEligibilityResults { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationEligibilityResultsCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationEligibilityResultsErrorInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationEligibilityResultsProperties { + #[serde(rename = "clientRequestId", default, skip_serializing_if = "Option::is_none")] + pub client_request_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationGroupDetails { + #[serde(flatten)] + pub configuration_settings: ConfigurationSettings, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProtectedItem { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProtectedItemCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProtectedItemProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "protectedItemType", default, skip_serializing_if = "Option::is_none")] + pub protected_item_type: Option, + #[serde(rename = "protectableItemId", default, skip_serializing_if = "Option::is_none")] + pub protectable_item_id: Option, + #[serde(rename = "recoveryServicesProviderId", default, skip_serializing_if = "Option::is_none")] + pub recovery_services_provider_id: Option, + #[serde(rename = "primaryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_friendly_name: Option, + #[serde(rename = "primaryFabricProvider", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_provider: Option, + #[serde(rename = "recoveryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_friendly_name: Option, + #[serde(rename = "recoveryFabricId", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_id: Option, + #[serde( + rename = "primaryProtectionContainerFriendlyName", + default, + skip_serializing_if = "Option::is_none" + )] + pub primary_protection_container_friendly_name: Option, + #[serde( + rename = "recoveryProtectionContainerFriendlyName", + default, + skip_serializing_if = "Option::is_none" + )] + pub recovery_protection_container_friendly_name: Option, + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[serde(rename = "protectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub protection_state_description: Option, + #[serde(rename = "activeLocation", default, skip_serializing_if = "Option::is_none")] + pub active_location: Option, + #[serde(rename = "testFailoverState", default, skip_serializing_if = "Option::is_none")] + pub test_failover_state: Option, + #[serde(rename = "testFailoverStateDescription", default, skip_serializing_if = "Option::is_none")] + pub test_failover_state_description: Option, + #[serde(rename = "allowedOperations", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_operations: Vec, + #[serde(rename = "replicationHealth", default, skip_serializing_if = "Option::is_none")] + pub replication_health: Option, + #[serde(rename = "failoverHealth", default, skip_serializing_if = "Option::is_none")] + pub failover_health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[serde(rename = "policyFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub policy_friendly_name: Option, + #[serde(rename = "lastSuccessfulFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_successful_failover_time: Option, + #[serde(rename = "lastSuccessfulTestFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_successful_test_failover_time: Option, + #[serde(rename = "currentScenario", default, skip_serializing_if = "Option::is_none")] + pub current_scenario: Option, + #[serde(rename = "failoverRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub failover_recovery_point_id: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, + #[serde(rename = "eventCorrelationId", default, skip_serializing_if = "Option::is_none")] + pub event_correlation_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProtectionIntent { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProtectionIntentCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProtectionIntentProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(rename = "jobState", default, skip_serializing_if = "Option::is_none")] + pub job_state: Option, + #[serde(rename = "isActive", default, skip_serializing_if = "Option::is_none")] + pub is_active: Option, + #[serde(rename = "creationTimeUTC", default, skip_serializing_if = "Option::is_none")] + pub creation_time_utc: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProtectionIntentProviderSpecificSettings { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderContainerUnmappingInput { + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderSpecificContainerCreationInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderSpecificContainerMappingInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderSpecificSettings { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderSpecificUpdateContainerMappingInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReprotectAgentDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[serde(rename = "accessibleDatastores", default, skip_serializing_if = "Vec::is_empty")] + pub accessible_datastores: Vec, + #[serde(rename = "vcenterId", default, skip_serializing_if = "Option::is_none")] + pub vcenter_id: Option, + #[serde(rename = "lastDiscoveryInUtc", default, skip_serializing_if = "Option::is_none")] + pub last_discovery_in_utc: Option, +} +pub mod reprotect_agent_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResolveHealthError { + #[serde(rename = "healthErrorId", default, skip_serializing_if = "Option::is_none")] + pub health_error_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResolveHealthInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResolveHealthInputProperties { + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceHealthSummary { + #[serde(rename = "resourceCount", default, skip_serializing_if = "Option::is_none")] + pub resource_count: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub issues: Vec, + #[serde(rename = "categorizedResourceCounts", default, skip_serializing_if = "Option::is_none")] + pub categorized_resource_counts: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResumeJobParams { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResumeJobParamsProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResyncInput { + pub properties: ResyncInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResyncInputProperties { + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: ResyncProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResyncProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionVolume { + #[serde(rename = "volumeName", default, skip_serializing_if = "Option::is_none")] + pub volume_name: Option, + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[serde(rename = "freeSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub free_space_in_bytes: Option, + #[serde(rename = "thresholdPercentage", default, skip_serializing_if = "Option::is_none")] + pub threshold_percentage: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReverseReplicationInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReverseReplicationInputProperties { + #[serde(rename = "failoverDirection", default, skip_serializing_if = "Option::is_none")] + pub failover_direction: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReverseReplicationProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleAssignment { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "roleDefinitionId", default, skip_serializing_if = "Option::is_none")] + pub role_definition_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunAsAccount { + #[serde(rename = "accountId", default, skip_serializing_if = "Option::is_none")] + pub account_id: Option, + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScriptActionTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub output: Option, + #[serde(rename = "isPrimarySideScript", default, skip_serializing_if = "Option::is_none")] + pub is_primary_side_script: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccountCustomDetails { + #[serde(rename = "resourceType")] + pub resource_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageClassification { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageClassificationCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageClassificationMapping { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageClassificationMappingCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageClassificationMappingInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageClassificationMappingProperties { + #[serde(rename = "targetStorageClassificationId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_classification_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageClassificationProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageMappingInputProperties { + #[serde(rename = "targetStorageClassificationId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_classification_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Subnet { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "addressList", default, skip_serializing_if = "Vec::is_empty")] + pub address_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedOsDetails { + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "osVersions", default, skip_serializing_if = "Vec::is_empty")] + pub os_versions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedOsProperties { + #[serde(rename = "supportedOsList", default, skip_serializing_if = "Vec::is_empty")] + pub supported_os_list: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedOsProperty { + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, + #[serde(rename = "supportedOs", default, skip_serializing_if = "Vec::is_empty")] + pub supported_os: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SupportedOperatingSystems { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchProtectionInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchProtectionInputProperties { + #[serde(rename = "replicationProtectedItemName", default, skip_serializing_if = "Option::is_none")] + pub replication_protected_item_name: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchProtectionJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[serde(rename = "newReplicationProtectedItemId", default, skip_serializing_if = "Option::is_none")] + pub new_replication_protected_item_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchProtectionProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetComputeSize { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetComputeSizeCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetComputeSizeProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "cpuCoresCount", default, skip_serializing_if = "Option::is_none")] + pub cpu_cores_count: Option, + #[serde(rename = "vCPUsAvailable", default, skip_serializing_if = "Option::is_none")] + pub v_cp_us_available: Option, + #[serde(rename = "memoryInGB", default, skip_serializing_if = "Option::is_none")] + pub memory_in_gb: Option, + #[serde(rename = "maxDataDiskCount", default, skip_serializing_if = "Option::is_none")] + pub max_data_disk_count: Option, + #[serde(rename = "maxNicsCount", default, skip_serializing_if = "Option::is_none")] + pub max_nics_count: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, + #[serde(rename = "highIopsSupported", default, skip_serializing_if = "Option::is_none")] + pub high_iops_supported: Option, + #[serde(rename = "hyperVGenerations", default, skip_serializing_if = "Vec::is_empty")] + pub hyper_v_generations: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskTypeDetails { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverCleanupInput { + pub properties: TestFailoverCleanupInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverCleanupInputProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverInput { + pub properties: TestFailoverInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverInputProperties { + #[serde(rename = "failoverDirection", default, skip_serializing_if = "Option::is_none")] + pub failover_direction: Option, + #[serde(rename = "networkType", default, skip_serializing_if = "Option::is_none")] + pub network_type: Option, + #[serde(rename = "networkId", default, skip_serializing_if = "Option::is_none")] + pub network_id: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[serde(rename = "testFailoverStatus", default, skip_serializing_if = "Option::is_none")] + pub test_failover_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, + #[serde(rename = "networkName", default, skip_serializing_if = "Option::is_none")] + pub network_name: Option, + #[serde(rename = "networkFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub network_friendly_name: Option, + #[serde(rename = "networkType", default, skip_serializing_if = "Option::is_none")] + pub network_type: Option, + #[serde(rename = "protectedItemDetails", default, skip_serializing_if = "Vec::is_empty")] + pub protected_item_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateCleanupInput { + pub properties: TestMigrateCleanupInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateCleanupInputProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateInput { + pub properties: TestMigrateInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateInputProperties { + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: TestMigrateProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnplannedFailoverInput { + pub properties: UnplannedFailoverInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnplannedFailoverInputProperties { + #[serde(rename = "failoverDirection", default, skip_serializing_if = "Option::is_none")] + pub failover_direction: Option, + #[serde(rename = "sourceSiteOperations", default, skip_serializing_if = "Option::is_none")] + pub source_site_operations: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnplannedFailoverProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateApplianceForReplicationProtectedItemInput { + pub properties: UpdateApplianceForReplicationProtectedItemInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateApplianceForReplicationProtectedItemInputProperties { + #[serde(rename = "targetApplianceId")] + pub target_appliance_id: String, + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: UpdateApplianceForReplicationProtectedItemProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateApplianceForReplicationProtectedItemProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateDiskInput { + #[serde(rename = "diskId")] + pub disk_id: String, + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateMigrationItemInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateMigrationItemInputProperties { + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: UpdateMigrationItemProviderSpecificInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateMigrationItemProviderSpecificInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateMobilityServiceRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateMobilityServiceRequestProperties { + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateNetworkMappingInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateNetworkMappingInputProperties { + #[serde(rename = "recoveryFabricName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_name: Option, + #[serde(rename = "recoveryNetworkId", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_id: Option, + #[serde(rename = "fabricSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub fabric_specific_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdatePolicyInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdatePolicyInputProperties { + #[serde(rename = "replicationProviderSettings", default, skip_serializing_if = "Option::is_none")] + pub replication_provider_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateProtectionContainerMappingInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateProtectionContainerMappingInputProperties { + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_input: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateRecoveryPlanInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateRecoveryPlanInputProperties { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub groups: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateReplicationProtectedItemInput { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateReplicationProtectedItemInputProperties { + #[serde(rename = "recoveryAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_name: Option, + #[serde(rename = "recoveryAzureVMSize", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_size: Option, + #[serde(rename = "selectedRecoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_recovery_azure_network_id: Option, + #[serde(rename = "selectedTfoAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_tfo_azure_network_id: Option, + #[serde(rename = "selectedSourceNicId", default, skip_serializing_if = "Option::is_none")] + pub selected_source_nic_id: Option, + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +pub mod update_replication_protected_item_input_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateReplicationProtectedItemProviderInput { + #[serde(rename = "instanceType")] + pub instance_type: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateVCenterRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateVCenterRequestProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VCenter { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VCenterCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VCenterProperties { + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "internalId", default, skip_serializing_if = "Option::is_none")] + pub internal_id: Option, + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[serde(rename = "discoveryStatus", default, skip_serializing_if = "Option::is_none")] + pub discovery_status: Option, + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "infrastructureId", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[serde(rename = "fabricArmResourceName", default, skip_serializing_if = "Option::is_none")] + pub fabric_arm_resource_name: Option, + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmNicDetails { + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[serde(rename = "replicaNicId", default, skip_serializing_if = "Option::is_none")] + pub replica_nic_id: Option, + #[serde(rename = "sourceNicArmId", default, skip_serializing_if = "Option::is_none")] + pub source_nic_arm_id: Option, + #[serde(rename = "vMNetworkName", default, skip_serializing_if = "Option::is_none")] + pub v_m_network_name: Option, + #[serde(rename = "recoveryVMNetworkId", default, skip_serializing_if = "Option::is_none")] + pub recovery_vm_network_id: Option, + #[serde(rename = "ipConfigs", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configs: Vec, + #[serde(rename = "selectionType", default, skip_serializing_if = "Option::is_none")] + pub selection_type: Option, + #[serde(rename = "recoveryNetworkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_security_group_id: Option, + #[serde(rename = "enableAcceleratedNetworkingOnRecovery", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking_on_recovery: Option, + #[serde(rename = "tfoVMNetworkId", default, skip_serializing_if = "Option::is_none")] + pub tfo_vm_network_id: Option, + #[serde(rename = "tfoNetworkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub tfo_network_security_group_id: Option, + #[serde(rename = "enableAcceleratedNetworkingOnTfo", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking_on_tfo: Option, + #[serde(rename = "recoveryNicName", default, skip_serializing_if = "Option::is_none")] + pub recovery_nic_name: Option, + #[serde(rename = "recoveryNicResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub recovery_nic_resource_group_name: Option, + #[serde(rename = "reuseExistingNic", default, skip_serializing_if = "Option::is_none")] + pub reuse_existing_nic: Option, + #[serde(rename = "tfoRecoveryNicName", default, skip_serializing_if = "Option::is_none")] + pub tfo_recovery_nic_name: Option, + #[serde(rename = "tfoRecoveryNicResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub tfo_recovery_nic_resource_group_name: Option, + #[serde(rename = "tfoReuseExistingNic", default, skip_serializing_if = "Option::is_none")] + pub tfo_reuse_existing_nic: Option, + #[serde(rename = "targetNicName", default, skip_serializing_if = "Option::is_none")] + pub target_nic_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmNicInputDetails { + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[serde(rename = "ipConfigs", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configs: Vec, + #[serde(rename = "selectionType", default, skip_serializing_if = "Option::is_none")] + pub selection_type: Option, + #[serde(rename = "recoveryNetworkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_security_group_id: Option, + #[serde(rename = "enableAcceleratedNetworkingOnRecovery", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking_on_recovery: Option, + #[serde(rename = "tfoNetworkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub tfo_network_security_group_id: Option, + #[serde(rename = "enableAcceleratedNetworkingOnTfo", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking_on_tfo: Option, + #[serde(rename = "recoveryNicName", default, skip_serializing_if = "Option::is_none")] + pub recovery_nic_name: Option, + #[serde(rename = "recoveryNicResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub recovery_nic_resource_group_name: Option, + #[serde(rename = "reuseExistingNic", default, skip_serializing_if = "Option::is_none")] + pub reuse_existing_nic: Option, + #[serde(rename = "tfoNicName", default, skip_serializing_if = "Option::is_none")] + pub tfo_nic_name: Option, + #[serde(rename = "tfoNicResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub tfo_nic_resource_group_name: Option, + #[serde(rename = "tfoReuseExistingNic", default, skip_serializing_if = "Option::is_none")] + pub tfo_reuse_existing_nic: Option, + #[serde(rename = "targetNicName", default, skip_serializing_if = "Option::is_none")] + pub target_nic_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtContainerCreationInput { + #[serde(flatten)] + pub replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtContainerMappingInput { + #[serde(flatten)] + pub replication_provider_specific_container_mapping_input: ReplicationProviderSpecificContainerMappingInput, + #[serde(rename = "keyVaultId")] + pub key_vault_id: String, + #[serde(rename = "keyVaultUri")] + pub key_vault_uri: String, + #[serde(rename = "storageAccountId")] + pub storage_account_id: String, + #[serde(rename = "storageAccountSasSecretName")] + pub storage_account_sas_secret_name: String, + #[serde(rename = "serviceBusConnectionStringSecretName")] + pub service_bus_connection_string_secret_name: String, + #[serde(rename = "targetLocation")] + pub target_location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtDiskInput { + #[serde(rename = "diskId")] + pub disk_id: String, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "isOSDisk")] + pub is_os_disk: String, + #[serde(rename = "logStorageAccountId")] + pub log_storage_account_id: String, + #[serde(rename = "logStorageAccountSasSecretName")] + pub log_storage_account_sas_secret_name: String, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +pub mod v_mware_cbt_disk_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtEnableMigrationInput { + #[serde(flatten)] + pub enable_migration_provider_specific_input: EnableMigrationProviderSpecificInput, + #[serde(rename = "vmwareMachineId")] + pub vmware_machine_id: String, + #[serde(rename = "disksToInclude")] + pub disks_to_include: Vec, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "dataMoverRunAsAccountId")] + pub data_mover_run_as_account_id: String, + #[serde(rename = "snapshotRunAsAccountId")] + pub snapshot_run_as_account_id: String, + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "targetResourceGroupId")] + pub target_resource_group_id: String, + #[serde(rename = "targetNetworkId")] + pub target_network_id: String, + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[serde(rename = "performAutoResync", default, skip_serializing_if = "Option::is_none")] + pub perform_auto_resync: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "seedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_disk_tags: Option, + #[serde(rename = "targetDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_disk_tags: Option, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +pub mod v_mware_cbt_enable_migration_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[serde(rename = "migrationItemName", default, skip_serializing_if = "Option::is_none")] + pub migration_item_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtMigrateInput { + #[serde(flatten)] + pub migrate_provider_specific_input: MigrateProviderSpecificInput, + #[serde(rename = "performShutdown")] + pub perform_shutdown: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtMigrationDetails { + #[serde(flatten)] + pub migration_provider_specific_settings: MigrationProviderSpecificSettings, + #[serde(rename = "vmwareMachineId", default, skip_serializing_if = "Option::is_none")] + pub vmware_machine_id: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "firmwareType", default, skip_serializing_if = "Option::is_none")] + pub firmware_type: Option, + #[serde(rename = "targetGeneration", default, skip_serializing_if = "Option::is_none")] + pub target_generation: Option, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "dataMoverRunAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub data_mover_run_as_account_id: Option, + #[serde(rename = "snapshotRunAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub snapshot_run_as_account_id: Option, + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "targetLocation", default, skip_serializing_if = "Option::is_none")] + pub target_location: Option, + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[serde(rename = "migrationRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub migration_recovery_point_id: Option, + #[serde(rename = "lastRecoveryPointReceived", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_received: Option, + #[serde(rename = "lastRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_id: Option, + #[serde(rename = "initialSeedingProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub initial_seeding_progress_percentage: Option, + #[serde(rename = "migrationProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub migration_progress_percentage: Option, + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[serde(rename = "initialSeedingRetryCount", default, skip_serializing_if = "Option::is_none")] + pub initial_seeding_retry_count: Option, + #[serde(rename = "resyncRetryCount", default, skip_serializing_if = "Option::is_none")] + pub resync_retry_count: Option, + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[serde(rename = "resyncState", default, skip_serializing_if = "Option::is_none")] + pub resync_state: Option, + #[serde(rename = "performAutoResync", default, skip_serializing_if = "Option::is_none")] + pub perform_auto_resync: Option, + #[serde(rename = "seedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_disk_tags: Option, + #[serde(rename = "targetDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_disk_tags: Option, +} +pub mod v_mware_cbt_migration_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncState { + None, + PreparedForResynchronization, + StartedResynchronization, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtNicDetails { + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[serde(rename = "isPrimaryNic", default, skip_serializing_if = "Option::is_none")] + pub is_primary_nic: Option, + #[serde(rename = "sourceIPAddress", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address: Option, + #[serde(rename = "sourceIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address_type: Option, + #[serde(rename = "sourceNetworkId", default, skip_serializing_if = "Option::is_none")] + pub source_network_id: Option, + #[serde(rename = "targetIPAddress", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address: Option, + #[serde(rename = "targetIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address_type: Option, + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[serde(rename = "targetNicName", default, skip_serializing_if = "Option::is_none")] + pub target_nic_name: Option, + #[serde(rename = "isSelectedForMigration", default, skip_serializing_if = "Option::is_none")] + pub is_selected_for_migration: Option, +} +pub mod v_mware_cbt_nic_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceIpAddressType { + Dynamic, + Static, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TargetIpAddressType { + Dynamic, + Static, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtNicInput { + #[serde(rename = "nicId")] + pub nic_id: String, + #[serde(rename = "isPrimaryNic")] + pub is_primary_nic: String, + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[serde(rename = "targetStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub target_static_ip_address: Option, + #[serde(rename = "isSelectedForMigration", default, skip_serializing_if = "Option::is_none")] + pub is_selected_for_migration: Option, + #[serde(rename = "targetNicName", default, skip_serializing_if = "Option::is_none")] + pub target_nic_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[serde(rename = "recoveryPointHistoryInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_in_minutes: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtProtectedDiskDetails { + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[serde(rename = "diskPath", default, skip_serializing_if = "Option::is_none")] + pub disk_path: Option, + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[serde(rename = "logStorageAccountSasSecretName", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_sas_secret_name: Option, + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[serde(rename = "seedManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_id: Option, + #[serde(rename = "targetManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_id: Option, + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, +} +pub mod v_mware_cbt_protected_disk_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtProtectionContainerMappingDetails { + #[serde(flatten)] + pub protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails, + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, + #[serde(rename = "keyVaultUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_uri: Option, + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[serde(rename = "storageAccountSasSecretName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_sas_secret_name: Option, + #[serde(rename = "serviceBusConnectionStringSecretName", default, skip_serializing_if = "Option::is_none")] + pub service_bus_connection_string_secret_name: Option, + #[serde(rename = "targetLocation", default, skip_serializing_if = "Option::is_none")] + pub target_location: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtResyncInput { + #[serde(flatten)] + pub resync_provider_specific_input: ResyncProviderSpecificInput, + #[serde(rename = "skipCbtReset")] + pub skip_cbt_reset: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtTestMigrateInput { + #[serde(flatten)] + pub test_migrate_provider_specific_input: TestMigrateProviderSpecificInput, + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, + #[serde(rename = "networkId")] + pub network_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtUpdateDiskInput { + #[serde(rename = "diskId")] + pub disk_id: String, + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtUpdateMigrationItemInput { + #[serde(flatten)] + pub update_migration_item_provider_specific_input: UpdateMigrationItemProviderSpecificInput, + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[serde(rename = "performAutoResync", default, skip_serializing_if = "Option::is_none")] + pub perform_auto_resync: Option, + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[serde(rename = "targetDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_disk_tags: Option, + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +pub mod v_mware_cbt_update_migration_item_input { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[serde(rename = "processServers", default, skip_serializing_if = "Vec::is_empty")] + pub process_servers: Vec, + #[serde(rename = "masterTargetServers", default, skip_serializing_if = "Vec::is_empty")] + pub master_target_servers: Vec, + #[serde(rename = "runAsAccounts", default, skip_serializing_if = "Vec::is_empty")] + pub run_as_accounts: Vec, + #[serde(rename = "replicationPairCount", default, skip_serializing_if = "Option::is_none")] + pub replication_pair_count: Option, + #[serde(rename = "processServerCount", default, skip_serializing_if = "Option::is_none")] + pub process_server_count: Option, + #[serde(rename = "agentCount", default, skip_serializing_if = "Option::is_none")] + pub agent_count: Option, + #[serde(rename = "protectedServers", default, skip_serializing_if = "Option::is_none")] + pub protected_servers: Option, + #[serde(rename = "systemLoad", default, skip_serializing_if = "Option::is_none")] + pub system_load: Option, + #[serde(rename = "systemLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub system_load_status: Option, + #[serde(rename = "cpuLoad", default, skip_serializing_if = "Option::is_none")] + pub cpu_load: Option, + #[serde(rename = "cpuLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub cpu_load_status: Option, + #[serde(rename = "totalMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_memory_in_bytes: Option, + #[serde(rename = "availableMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_memory_in_bytes: Option, + #[serde(rename = "memoryUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub memory_usage_status: Option, + #[serde(rename = "totalSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_space_in_bytes: Option, + #[serde(rename = "availableSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_space_in_bytes: Option, + #[serde(rename = "spaceUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub space_usage_status: Option, + #[serde(rename = "webLoad", default, skip_serializing_if = "Option::is_none")] + pub web_load: Option, + #[serde(rename = "webLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub web_load_status: Option, + #[serde(rename = "databaseServerLoad", default, skip_serializing_if = "Option::is_none")] + pub database_server_load: Option, + #[serde(rename = "databaseServerLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub database_server_load_status: Option, + #[serde(rename = "csServiceStatus", default, skip_serializing_if = "Option::is_none")] + pub cs_service_status: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[serde(rename = "versionStatus", default, skip_serializing_if = "Option::is_none")] + pub version_status: Option, + #[serde(rename = "sslCertExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub ssl_cert_expiry_date: Option, + #[serde(rename = "sslCertExpiryRemainingDays", default, skip_serializing_if = "Option::is_none")] + pub ssl_cert_expiry_remaining_days: Option, + #[serde(rename = "psTemplateVersion", default, skip_serializing_if = "Option::is_none")] + pub ps_template_version: Option, + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[serde(rename = "agentVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub agent_version_details: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareV2FabricCreationInput { + #[serde(flatten)] + pub fabric_specific_creation_input: FabricSpecificCreationInput, + #[serde(rename = "vmwareSiteId", default, skip_serializing_if = "Option::is_none")] + pub vmware_site_id: Option, + #[serde(rename = "physicalSiteId", default, skip_serializing_if = "Option::is_none")] + pub physical_site_id: Option, + #[serde(rename = "migrationSolutionId")] + pub migration_solution_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareV2FabricSpecificDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[serde(rename = "vmwareSiteId", default, skip_serializing_if = "Option::is_none")] + pub vmware_site_id: Option, + #[serde(rename = "physicalSiteId", default, skip_serializing_if = "Option::is_none")] + pub physical_site_id: Option, + #[serde(rename = "migrationSolutionId", default, skip_serializing_if = "Option::is_none")] + pub migration_solution_id: Option, + #[serde(rename = "serviceEndpoint", default, skip_serializing_if = "Option::is_none")] + pub service_endpoint: Option, + #[serde(rename = "serviceResourceId", default, skip_serializing_if = "Option::is_none")] + pub service_resource_id: Option, + #[serde(rename = "serviceContainerId", default, skip_serializing_if = "Option::is_none")] + pub service_container_id: Option, + #[serde(rename = "processServers", default, skip_serializing_if = "Vec::is_empty")] + pub process_servers: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareVirtualMachineDetails { + #[serde(flatten)] + pub configuration_settings: ConfigurationSettings, + #[serde(rename = "agentGeneratedId", default, skip_serializing_if = "Option::is_none")] + pub agent_generated_id: Option, + #[serde(rename = "agentInstalled", default, skip_serializing_if = "Option::is_none")] + pub agent_installed: Option, + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[serde(rename = "poweredOn", default, skip_serializing_if = "Option::is_none")] + pub powered_on: Option, + #[serde(rename = "vCenterInfrastructureId", default, skip_serializing_if = "Option::is_none")] + pub v_center_infrastructure_id: Option, + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[serde(rename = "diskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub disk_details: Vec, + #[serde(rename = "validationErrors", default, skip_serializing_if = "Vec::is_empty")] + pub validation_errors: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultHealthDetails { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultHealthProperties { + #[serde(rename = "vaultErrors", default, skip_serializing_if = "Vec::is_empty")] + pub vault_errors: Vec, + #[serde(rename = "protectedItemsHealth", default, skip_serializing_if = "Option::is_none")] + pub protected_items_health: Option, + #[serde(rename = "fabricsHealth", default, skip_serializing_if = "Option::is_none")] + pub fabrics_health: Option, + #[serde(rename = "containersHealth", default, skip_serializing_if = "Option::is_none")] + pub containers_health: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultSetting { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultSettingCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultSettingCreationInput { + pub properties: VaultSettingCreationInputProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultSettingCreationInputProperties { + #[serde(rename = "migrationSolutionId", default, skip_serializing_if = "Option::is_none")] + pub migration_solution_id: Option, + #[serde(rename = "vmwareToAzureProviderType", default, skip_serializing_if = "Option::is_none")] + pub vmware_to_azure_provider_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultSettingProperties { + #[serde(rename = "migrationSolutionId", default, skip_serializing_if = "Option::is_none")] + pub migration_solution_id: Option, + #[serde(rename = "vmwareToAzureProviderType", default, skip_serializing_if = "Option::is_none")] + pub vmware_to_azure_provider_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VersionDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "expiryDate", default, skip_serializing_if = "Option::is_none")] + pub expiry_date: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod version_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Supported, + NotSupported, + Deprecated, + UpdateRequired, + SecurityUpdateRequired, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineTaskDetails { + #[serde(flatten)] + pub job_task_details: JobTaskDetails, + #[serde(rename = "skippedReason", default, skip_serializing_if = "Option::is_none")] + pub skipped_reason: Option, + #[serde(rename = "skippedReasonString", default, skip_serializing_if = "Option::is_none")] + pub skipped_reason_string: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmNicUpdatesTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToAzureCreateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToAzureNetworkMappingSettings { + #[serde(flatten)] + pub network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToAzureUpdateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToVmmCreateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToVmmNetworkMappingSettings { + #[serde(flatten)] + pub network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToVmmUpdateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmVirtualMachineDetails { + #[serde(flatten)] + pub hyper_v_virtual_machine_details: HyperVVirtualMachineDetails, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmwareCbtPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[serde(rename = "recoveryPointHistoryInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_in_minutes: Option, + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, +} diff --git a/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/operations.rs b/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/operations.rs new file mode 100644 index 0000000000..0dfb4bb41d --- /dev/null +++ b/services/mgmt/recoveryservicessiterecovery/src/package_2021_10/operations.rs @@ -0,0 +1,12906 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn migration_recovery_points(&self) -> migration_recovery_points::Client { + migration_recovery_points::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn replication_alert_settings(&self) -> replication_alert_settings::Client { + replication_alert_settings::Client(self.clone()) + } + pub fn replication_eligibility_results(&self) -> replication_eligibility_results::Client { + replication_eligibility_results::Client(self.clone()) + } + pub fn replication_events(&self) -> replication_events::Client { + replication_events::Client(self.clone()) + } + pub fn replication_fabrics(&self) -> replication_fabrics::Client { + replication_fabrics::Client(self.clone()) + } + pub fn replication_jobs(&self) -> replication_jobs::Client { + replication_jobs::Client(self.clone()) + } + pub fn replication_logical_networks(&self) -> replication_logical_networks::Client { + replication_logical_networks::Client(self.clone()) + } + pub fn replication_migration_items(&self) -> replication_migration_items::Client { + replication_migration_items::Client(self.clone()) + } + pub fn replication_network_mappings(&self) -> replication_network_mappings::Client { + replication_network_mappings::Client(self.clone()) + } + pub fn replication_networks(&self) -> replication_networks::Client { + replication_networks::Client(self.clone()) + } + pub fn replication_policies(&self) -> replication_policies::Client { + replication_policies::Client(self.clone()) + } + pub fn replication_protectable_items(&self) -> replication_protectable_items::Client { + replication_protectable_items::Client(self.clone()) + } + pub fn replication_protected_items(&self) -> replication_protected_items::Client { + replication_protected_items::Client(self.clone()) + } + pub fn replication_protection_container_mappings(&self) -> replication_protection_container_mappings::Client { + replication_protection_container_mappings::Client(self.clone()) + } + pub fn replication_protection_containers(&self) -> replication_protection_containers::Client { + replication_protection_containers::Client(self.clone()) + } + pub fn replication_protection_intents(&self) -> replication_protection_intents::Client { + replication_protection_intents::Client(self.clone()) + } + pub fn replication_recovery_plans(&self) -> replication_recovery_plans::Client { + replication_recovery_plans::Client(self.clone()) + } + pub fn replication_recovery_services_providers(&self) -> replication_recovery_services_providers::Client { + replication_recovery_services_providers::Client(self.clone()) + } + pub fn replication_storage_classification_mappings(&self) -> replication_storage_classification_mappings::Client { + replication_storage_classification_mappings::Client(self.clone()) + } + pub fn replication_storage_classifications(&self) -> replication_storage_classifications::Client { + replication_storage_classifications::Client(self.clone()) + } + pub fn replication_vault_health(&self) -> replication_vault_health::Client { + replication_vault_health::Client(self.clone()) + } + pub fn replication_vault_setting(&self) -> replication_vault_setting::Client { + replication_vault_setting::Client(self.clone()) + } + pub fn replicationv_centers(&self) -> replicationv_centers::Client { + replicationv_centers::Client(self.clone()) + } + pub fn supported_operating_systems(&self) -> supported_operating_systems::Client { + supported_operating_systems::Client(self.clone()) + } + pub fn target_compute_sizes(&self) -> target_compute_sizes::Client { + target_compute_sizes::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ReplicationAlertSettings_List(#[from] replication_alert_settings::list::Error), + #[error(transparent)] + ReplicationAlertSettings_Get(#[from] replication_alert_settings::get::Error), + #[error(transparent)] + ReplicationAlertSettings_Create(#[from] replication_alert_settings::create::Error), + #[error(transparent)] + ReplicationEligibilityResults_List(#[from] replication_eligibility_results::list::Error), + #[error(transparent)] + ReplicationEligibilityResults_Get(#[from] replication_eligibility_results::get::Error), + #[error(transparent)] + ReplicationEvents_List(#[from] replication_events::list::Error), + #[error(transparent)] + ReplicationEvents_Get(#[from] replication_events::get::Error), + #[error(transparent)] + ReplicationFabrics_List(#[from] replication_fabrics::list::Error), + #[error(transparent)] + ReplicationFabrics_Get(#[from] replication_fabrics::get::Error), + #[error(transparent)] + ReplicationFabrics_Create(#[from] replication_fabrics::create::Error), + #[error(transparent)] + ReplicationFabrics_Purge(#[from] replication_fabrics::purge::Error), + #[error(transparent)] + ReplicationFabrics_CheckConsistency(#[from] replication_fabrics::check_consistency::Error), + #[error(transparent)] + ReplicationFabrics_MigrateToAad(#[from] replication_fabrics::migrate_to_aad::Error), + #[error(transparent)] + ReplicationFabrics_ReassociateGateway(#[from] replication_fabrics::reassociate_gateway::Error), + #[error(transparent)] + ReplicationFabrics_Delete(#[from] replication_fabrics::delete::Error), + #[error(transparent)] + ReplicationFabrics_RenewCertificate(#[from] replication_fabrics::renew_certificate::Error), + #[error(transparent)] + ReplicationLogicalNetworks_ListByReplicationFabrics(#[from] replication_logical_networks::list_by_replication_fabrics::Error), + #[error(transparent)] + ReplicationLogicalNetworks_Get(#[from] replication_logical_networks::get::Error), + #[error(transparent)] + ReplicationNetworks_ListByReplicationFabrics(#[from] replication_networks::list_by_replication_fabrics::Error), + #[error(transparent)] + ReplicationNetworks_Get(#[from] replication_networks::get::Error), + #[error(transparent)] + ReplicationNetworkMappings_ListByReplicationNetworks(#[from] replication_network_mappings::list_by_replication_networks::Error), + #[error(transparent)] + ReplicationNetworkMappings_Get(#[from] replication_network_mappings::get::Error), + #[error(transparent)] + ReplicationNetworkMappings_Create(#[from] replication_network_mappings::create::Error), + #[error(transparent)] + ReplicationNetworkMappings_Update(#[from] replication_network_mappings::update::Error), + #[error(transparent)] + ReplicationNetworkMappings_Delete(#[from] replication_network_mappings::delete::Error), + #[error(transparent)] + ReplicationProtectionContainers_ListByReplicationFabrics(#[from] replication_protection_containers::list_by_replication_fabrics::Error), + #[error(transparent)] + ReplicationProtectionContainers_Get(#[from] replication_protection_containers::get::Error), + #[error(transparent)] + ReplicationProtectionContainers_Create(#[from] replication_protection_containers::create::Error), + #[error(transparent)] + ReplicationProtectionContainers_DiscoverProtectableItem(#[from] replication_protection_containers::discover_protectable_item::Error), + #[error(transparent)] + ReplicationProtectionContainers_Delete(#[from] replication_protection_containers::delete::Error), + #[error(transparent)] + ReplicationMigrationItems_ListByReplicationProtectionContainers( + #[from] replication_migration_items::list_by_replication_protection_containers::Error, + ), + #[error(transparent)] + ReplicationMigrationItems_Get(#[from] replication_migration_items::get::Error), + #[error(transparent)] + ReplicationMigrationItems_Create(#[from] replication_migration_items::create::Error), + #[error(transparent)] + ReplicationMigrationItems_Update(#[from] replication_migration_items::update::Error), + #[error(transparent)] + ReplicationMigrationItems_Delete(#[from] replication_migration_items::delete::Error), + #[error(transparent)] + ReplicationMigrationItems_Migrate(#[from] replication_migration_items::migrate::Error), + #[error(transparent)] + MigrationRecoveryPoints_ListByReplicationMigrationItems(#[from] migration_recovery_points::list_by_replication_migration_items::Error), + #[error(transparent)] + MigrationRecoveryPoints_Get(#[from] migration_recovery_points::get::Error), + #[error(transparent)] + ReplicationMigrationItems_Resync(#[from] replication_migration_items::resync::Error), + #[error(transparent)] + ReplicationMigrationItems_TestMigrate(#[from] replication_migration_items::test_migrate::Error), + #[error(transparent)] + ReplicationMigrationItems_TestMigrateCleanup(#[from] replication_migration_items::test_migrate_cleanup::Error), + #[error(transparent)] + ReplicationProtectableItems_ListByReplicationProtectionContainers( + #[from] replication_protectable_items::list_by_replication_protection_containers::Error, + ), + #[error(transparent)] + ReplicationProtectableItems_Get(#[from] replication_protectable_items::get::Error), + #[error(transparent)] + ReplicationProtectedItems_ListByReplicationProtectionContainers( + #[from] replication_protected_items::list_by_replication_protection_containers::Error, + ), + #[error(transparent)] + ReplicationProtectedItems_Get(#[from] replication_protected_items::get::Error), + #[error(transparent)] + ReplicationProtectedItems_Create(#[from] replication_protected_items::create::Error), + #[error(transparent)] + ReplicationProtectedItems_Update(#[from] replication_protected_items::update::Error), + #[error(transparent)] + ReplicationProtectedItems_Purge(#[from] replication_protected_items::purge::Error), + #[error(transparent)] + ReplicationProtectedItems_AddDisks(#[from] replication_protected_items::add_disks::Error), + #[error(transparent)] + ReplicationProtectedItems_ApplyRecoveryPoint(#[from] replication_protected_items::apply_recovery_point::Error), + #[error(transparent)] + ReplicationProtectedItems_FailoverCancel(#[from] replication_protected_items::failover_cancel::Error), + #[error(transparent)] + ReplicationProtectedItems_FailoverCommit(#[from] replication_protected_items::failover_commit::Error), + #[error(transparent)] + ReplicationProtectedItems_PlannedFailover(#[from] replication_protected_items::planned_failover::Error), + #[error(transparent)] + RecoveryPoints_ListByReplicationProtectedItems(#[from] recovery_points::list_by_replication_protected_items::Error), + #[error(transparent)] + RecoveryPoints_Get(#[from] recovery_points::get::Error), + #[error(transparent)] + ReplicationProtectedItems_Delete(#[from] replication_protected_items::delete::Error), + #[error(transparent)] + ReplicationProtectedItems_RemoveDisks(#[from] replication_protected_items::remove_disks::Error), + #[error(transparent)] + ReplicationProtectedItems_RepairReplication(#[from] replication_protected_items::repair_replication::Error), + #[error(transparent)] + ReplicationProtectedItems_Reprotect(#[from] replication_protected_items::reprotect::Error), + #[error(transparent)] + ReplicationProtectedItems_ResolveHealthErrors(#[from] replication_protected_items::resolve_health_errors::Error), + #[error(transparent)] + TargetComputeSizes_ListByReplicationProtectedItems(#[from] target_compute_sizes::list_by_replication_protected_items::Error), + #[error(transparent)] + ReplicationProtectedItems_TestFailover(#[from] replication_protected_items::test_failover::Error), + #[error(transparent)] + ReplicationProtectedItems_TestFailoverCleanup(#[from] replication_protected_items::test_failover_cleanup::Error), + #[error(transparent)] + ReplicationProtectedItems_UnplannedFailover(#[from] replication_protected_items::unplanned_failover::Error), + #[error(transparent)] + ReplicationProtectedItems_UpdateAppliance(#[from] replication_protected_items::update_appliance::Error), + #[error(transparent)] + ReplicationProtectedItems_UpdateMobilityService(#[from] replication_protected_items::update_mobility_service::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers( + #[from] replication_protection_container_mappings::list_by_replication_protection_containers::Error, + ), + #[error(transparent)] + ReplicationProtectionContainerMappings_Get(#[from] replication_protection_container_mappings::get::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_Create(#[from] replication_protection_container_mappings::create::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_Update(#[from] replication_protection_container_mappings::update::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_Purge(#[from] replication_protection_container_mappings::purge::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_Delete(#[from] replication_protection_container_mappings::delete::Error), + #[error(transparent)] + ReplicationProtectionContainers_SwitchProtection(#[from] replication_protection_containers::switch_protection::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_ListByReplicationFabrics( + #[from] replication_recovery_services_providers::list_by_replication_fabrics::Error, + ), + #[error(transparent)] + ReplicationRecoveryServicesProviders_Get(#[from] replication_recovery_services_providers::get::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_Create(#[from] replication_recovery_services_providers::create::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_Purge(#[from] replication_recovery_services_providers::purge::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_RefreshProvider(#[from] replication_recovery_services_providers::refresh_provider::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_Delete(#[from] replication_recovery_services_providers::delete::Error), + #[error(transparent)] + ReplicationStorageClassifications_ListByReplicationFabrics( + #[from] replication_storage_classifications::list_by_replication_fabrics::Error, + ), + #[error(transparent)] + ReplicationStorageClassifications_Get(#[from] replication_storage_classifications::get::Error), + #[error(transparent)] + ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications( + #[from] replication_storage_classification_mappings::list_by_replication_storage_classifications::Error, + ), + #[error(transparent)] + ReplicationStorageClassificationMappings_Get(#[from] replication_storage_classification_mappings::get::Error), + #[error(transparent)] + ReplicationStorageClassificationMappings_Create(#[from] replication_storage_classification_mappings::create::Error), + #[error(transparent)] + ReplicationStorageClassificationMappings_Delete(#[from] replication_storage_classification_mappings::delete::Error), + #[error(transparent)] + ReplicationvCenters_ListByReplicationFabrics(#[from] replicationv_centers::list_by_replication_fabrics::Error), + #[error(transparent)] + ReplicationvCenters_Get(#[from] replicationv_centers::get::Error), + #[error(transparent)] + ReplicationvCenters_Create(#[from] replicationv_centers::create::Error), + #[error(transparent)] + ReplicationvCenters_Update(#[from] replicationv_centers::update::Error), + #[error(transparent)] + ReplicationvCenters_Delete(#[from] replicationv_centers::delete::Error), + #[error(transparent)] + ReplicationJobs_List(#[from] replication_jobs::list::Error), + #[error(transparent)] + ReplicationJobs_Get(#[from] replication_jobs::get::Error), + #[error(transparent)] + ReplicationJobs_Cancel(#[from] replication_jobs::cancel::Error), + #[error(transparent)] + ReplicationJobs_Restart(#[from] replication_jobs::restart::Error), + #[error(transparent)] + ReplicationJobs_Resume(#[from] replication_jobs::resume::Error), + #[error(transparent)] + ReplicationJobs_Export(#[from] replication_jobs::export::Error), + #[error(transparent)] + ReplicationMigrationItems_List(#[from] replication_migration_items::list::Error), + #[error(transparent)] + ReplicationNetworkMappings_List(#[from] replication_network_mappings::list::Error), + #[error(transparent)] + ReplicationNetworks_List(#[from] replication_networks::list::Error), + #[error(transparent)] + ReplicationPolicies_List(#[from] replication_policies::list::Error), + #[error(transparent)] + ReplicationPolicies_Get(#[from] replication_policies::get::Error), + #[error(transparent)] + ReplicationPolicies_Create(#[from] replication_policies::create::Error), + #[error(transparent)] + ReplicationPolicies_Update(#[from] replication_policies::update::Error), + #[error(transparent)] + ReplicationPolicies_Delete(#[from] replication_policies::delete::Error), + #[error(transparent)] + ReplicationProtectedItems_List(#[from] replication_protected_items::list::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_List(#[from] replication_protection_container_mappings::list::Error), + #[error(transparent)] + ReplicationProtectionContainers_List(#[from] replication_protection_containers::list::Error), + #[error(transparent)] + ReplicationProtectionIntents_List(#[from] replication_protection_intents::list::Error), + #[error(transparent)] + ReplicationProtectionIntents_Get(#[from] replication_protection_intents::get::Error), + #[error(transparent)] + ReplicationProtectionIntents_Create(#[from] replication_protection_intents::create::Error), + #[error(transparent)] + ReplicationRecoveryPlans_List(#[from] replication_recovery_plans::list::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Get(#[from] replication_recovery_plans::get::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Create(#[from] replication_recovery_plans::create::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Update(#[from] replication_recovery_plans::update::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Delete(#[from] replication_recovery_plans::delete::Error), + #[error(transparent)] + ReplicationRecoveryPlans_FailoverCancel(#[from] replication_recovery_plans::failover_cancel::Error), + #[error(transparent)] + ReplicationRecoveryPlans_FailoverCommit(#[from] replication_recovery_plans::failover_commit::Error), + #[error(transparent)] + ReplicationRecoveryPlans_PlannedFailover(#[from] replication_recovery_plans::planned_failover::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Reprotect(#[from] replication_recovery_plans::reprotect::Error), + #[error(transparent)] + ReplicationRecoveryPlans_TestFailover(#[from] replication_recovery_plans::test_failover::Error), + #[error(transparent)] + ReplicationRecoveryPlans_TestFailoverCleanup(#[from] replication_recovery_plans::test_failover_cleanup::Error), + #[error(transparent)] + ReplicationRecoveryPlans_UnplannedFailover(#[from] replication_recovery_plans::unplanned_failover::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_List(#[from] replication_recovery_services_providers::list::Error), + #[error(transparent)] + ReplicationStorageClassificationMappings_List(#[from] replication_storage_classification_mappings::list::Error), + #[error(transparent)] + ReplicationStorageClassifications_List(#[from] replication_storage_classifications::list::Error), + #[error(transparent)] + SupportedOperatingSystems_Get(#[from] supported_operating_systems::get::Error), + #[error(transparent)] + ReplicationVaultHealth_Get(#[from] replication_vault_health::get::Error), + #[error(transparent)] + ReplicationVaultHealth_Refresh(#[from] replication_vault_health::refresh::Error), + #[error(transparent)] + ReplicationVaultSetting_List(#[from] replication_vault_setting::list::Error), + #[error(transparent)] + ReplicationVaultSetting_Get(#[from] replication_vault_setting::get::Error), + #[error(transparent)] + ReplicationVaultSetting_Create(#[from] replication_vault_setting::create::Error), + #[error(transparent)] + ReplicationvCenters_List(#[from] replicationv_centers::list::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns the list of available operations."] + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/operations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsDiscoveryCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_alert_settings { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of configured email notification(alert) configurations."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets an email notification(alert) configuration."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + alert_setting_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + alert_setting_name: alert_setting_name.into(), + } + } + #[doc = "Configures email notifications for this vault."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + alert_setting_name: impl Into, + request: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + alert_setting_name: alert_setting_name.into(), + request: request.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationAlertSettings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) alert_setting_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationAlertSettings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.alert_setting_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) alert_setting_name: String, + pub(crate) request: models::ConfigureAlertRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationAlertSettings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.alert_setting_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_eligibility_results { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the validation errors in case the VM is unsuitable for protection."] + pub fn list( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + } + } + #[doc = "Gets the validation errors in case the VM is unsuitable for protection."] + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/providers/Microsoft.RecoveryServices/replicationEligibilityResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationEligibilityResultsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationEligibilityResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_events { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of Azure Site Recovery events."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + #[doc = "Get the details of an Azure Site recovery event."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + event_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + event_name: event_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationEvents", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EventCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) event_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationEvents/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.event_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Event = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_fabrics { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of ASR fabrics."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the details of an ASR fabric."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + filter: None, + } + } + #[doc = "Creates an Azure Site Recovery fabric."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + input: input.into(), + } + } + #[doc = "Purges the site."] + pub fn purge( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Checks the consistency of the ASR fabric."] + pub fn check_consistency( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> check_consistency::Builder { + check_consistency::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Migrates the site to AAD."] + pub fn migrate_to_aad( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> migrate_to_aad::Builder { + migrate_to_aad::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Perform failover of the process server."] + pub fn reassociate_gateway( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + failover_process_server_request: impl Into, + ) -> reassociate_gateway::Builder { + reassociate_gateway::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + failover_process_server_request: failover_process_server_request.into(), + } + } + #[doc = "Deletes the site."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Renews certificate for the fabric."] + pub fn renew_certificate( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + renew_certificate: impl Into, + ) -> renew_certificate::Builder { + renew_certificate::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + renew_certificate: renew_certificate.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FabricCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.fabric_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Fabric), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) input: models::FabricCreationInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.fabric_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod purge { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.fabric_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod check_consistency { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Fabric), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/checkConsistency" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_to_aad { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/migratetoaad" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reassociate_gateway { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Fabric), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) failover_process_server_request: models::FailoverProcessServerRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/reassociateGateway" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.failover_process_server_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/remove", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.fabric_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod renew_certificate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Fabric), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) renew_certificate: models::RenewCertificateInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/renewCertificate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.renew_certificate).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_logical_networks { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of logical networks under a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets a logical network with specified server id and logical network name."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + logical_network_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + logical_network_name: logical_network_name.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationLogicalNetworks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogicalNetworkCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) logical_network_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationLogicalNetworks/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . logical_network_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogicalNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_networks { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of networks under a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets a network with specified server id and network name."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + } + } + #[doc = "Gets the list of networks. View-only API."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Network = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationNetworks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_network_mappings { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets all the network mappings under a network."] + pub fn list_by_replication_networks( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + ) -> list_by_replication_networks::Builder { + list_by_replication_networks::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + } + } + #[doc = "Gets network mapping by name."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + network_mapping_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + network_mapping_name: network_mapping_name.into(), + } + } + #[doc = "Creates network mapping."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + network_mapping_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + network_mapping_name: network_mapping_name.into(), + input: input.into(), + } + } + #[doc = "Updates network mapping."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + network_mapping_name: impl Into, + input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + network_mapping_name: network_mapping_name.into(), + input: input.into(), + } + } + #[doc = "Delete network mapping."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + network_mapping_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + network_mapping_name: network_mapping_name.into(), + } + } + #[doc = "Gets all the network mappings under a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_networks { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + pub(crate) network_mapping_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name , & self . network_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetworkMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + pub(crate) network_mapping_name: String, + pub(crate) input: models::CreateNetworkMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name , & self . network_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetworkMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + pub(crate) network_mapping_name: String, + pub(crate) input: models::UpdateNetworkMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name , & self . network_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + pub(crate) network_mapping_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name , & self . network_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationNetworkMappings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protection_containers { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of protection container for a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets the protection container details."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + } + } + #[doc = "Create a protection container."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + creation_input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + creation_input: creation_input.into(), + } + } + #[doc = "Adds a protectable item to the replication protection container."] + pub fn discover_protectable_item( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + discover_protectable_item_request: impl Into, + ) -> discover_protectable_item::Builder { + discover_protectable_item::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + discover_protectable_item_request: discover_protectable_item_request.into(), + } + } + #[doc = "Removes a protection container."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + } + } + #[doc = "Switches protection from one container to another or one replication provider to another."] + pub fn switch_protection( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + switch_input: impl Into, + ) -> switch_protection::Builder { + switch_protection::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + switch_input: switch_input.into(), + } + } + #[doc = "Gets the list of all protection containers in a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainer), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) creation_input: models::CreateProtectionContainerInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.creation_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod discover_protectable_item { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainer), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) discover_protectable_item_request: models::DiscoverProtectableItemRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/discoverProtectableItem" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.discover_protectable_item_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/remove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod switch_protection { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainer), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) switch_input: models::SwitchProtectionInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/switchprotection" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.switch_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_migration_items { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of migration items in the protection container."] + pub fn list_by_replication_protection_containers( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> list_by_replication_protection_containers::Builder { + list_by_replication_protection_containers::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + skip_token: None, + take_token: None, + filter: None, + } + } + #[doc = "Gets the details of a migration item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + } + } + #[doc = "Enables migration."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + input: input.into(), + } + } + #[doc = "Updates migration item."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + input: input.into(), + } + } + #[doc = "Delete the migration item."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + delete_option: None, + } + } + #[doc = "Migrate item."] + pub fn migrate( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + migrate_input: impl Into, + ) -> migrate::Builder { + migrate::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + migrate_input: migrate_input.into(), + } + } + #[doc = "Resynchronizes replication."] + pub fn resync( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + input: impl Into, + ) -> resync::Builder { + resync::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + input: input.into(), + } + } + #[doc = "Test migrate item."] + pub fn test_migrate( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + test_migrate_input: impl Into, + ) -> test_migrate::Builder { + test_migrate::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + test_migrate_input: test_migrate_input.into(), + } + } + #[doc = "Test migrate cleanup."] + pub fn test_migrate_cleanup( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + test_migrate_cleanup_input: impl Into, + ) -> test_migrate_cleanup::Builder { + test_migrate_cleanup::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + test_migrate_cleanup_input: test_migrate_cleanup_input.into(), + } + } + #[doc = "Gets the list of migration items in the vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + skip_token: None, + take_token: None, + filter: None, + } + } + } + pub mod list_by_replication_protection_containers { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) skip_token: Option, + pub(crate) take_token: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn take_token(mut self, take_token: impl Into) -> Self { + self.take_token = Some(take_token.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("skipToken", skip_token); + } + if let Some(take_token) = &self.take_token { + url.query_pairs_mut().append_pair("takeToken", take_token); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) input: models::EnableMigrationInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) input: models::UpdateMigrationItemInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) delete_option: Option, + } + impl Builder { + pub fn delete_option(mut self, delete_option: impl Into) -> Self { + self.delete_option = Some(delete_option.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(delete_option) = &self.delete_option { + url.query_pairs_mut().append_pair("deleteOption", delete_option); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) migrate_input: models::MigrateInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/migrate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.migrate_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod resync { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) input: models::ResyncInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/resync" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_migrate { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) test_migrate_input: models::TestMigrateInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/testMigrate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.test_migrate_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_migrate_cleanup { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) test_migrate_cleanup_input: models::TestMigrateCleanupInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/testMigrateCleanup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.test_migrate_cleanup_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) skip_token: Option, + pub(crate) take_token: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn take_token(mut self, take_token: impl Into) -> Self { + self.take_token = Some(take_token.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationMigrationItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("skipToken", skip_token); + } + if let Some(take_token) = &self.take_token { + url.query_pairs_mut().append_pair("takeToken", take_token); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod migration_recovery_points { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the recovery points for a migration item."] + pub fn list_by_replication_migration_items( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + ) -> list_by_replication_migration_items::Builder { + list_by_replication_migration_items::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + } + } + #[doc = "Gets a recovery point for a migration item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + migration_recovery_point_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + migration_recovery_point_name: migration_recovery_point_name.into(), + } + } + } + pub mod list_by_replication_migration_items { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/migrationRecoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationRecoveryPointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) migration_recovery_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/migrationRecoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name , & self . migration_recovery_point_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationRecoveryPoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protectable_items { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of protectable items."] + pub fn list_by_replication_protection_containers( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> list_by_replication_protection_containers::Builder { + list_by_replication_protection_containers::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + filter: None, + take: None, + skip_token: None, + } + } + #[doc = "Gets the details of a protectable item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + protectable_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + protectable_item_name: protectable_item_name.into(), + } + } + } + pub mod list_by_replication_protection_containers { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) filter: Option, + pub(crate) take: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn take(mut self, take: impl Into) -> Self { + self.take = Some(take.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectableItems" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(take) = &self.take { + url.query_pairs_mut().append_pair("$take", take); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectableItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) protectable_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectableItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . protectable_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectableItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protected_items { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of Replication protected items."] + pub fn list_by_replication_protection_containers( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> list_by_replication_protection_containers::Builder { + list_by_replication_protection_containers::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + } + } + #[doc = "Gets the details of a Replication protected item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Enables protection."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + input: input.into(), + } + } + #[doc = "Updates the replication protected item settings."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + update_protection_input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + update_protection_input: update_protection_input.into(), + } + } + #[doc = "Purges protection."] + pub fn purge( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Add disk(s) for protection."] + pub fn add_disks( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + add_disks_input: impl Into, + ) -> add_disks::Builder { + add_disks::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + add_disks_input: add_disks_input.into(), + } + } + #[doc = "Change or apply recovery point."] + pub fn apply_recovery_point( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + apply_recovery_point_input: impl Into, + ) -> apply_recovery_point::Builder { + apply_recovery_point::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + apply_recovery_point_input: apply_recovery_point_input.into(), + } + } + #[doc = "Execute cancel failover."] + pub fn failover_cancel( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> failover_cancel::Builder { + failover_cancel::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Execute commit failover."] + pub fn failover_commit( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> failover_commit::Builder { + failover_commit::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Execute planned failover."] + pub fn planned_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + failover_input: impl Into, + ) -> planned_failover::Builder { + planned_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + failover_input: failover_input.into(), + } + } + #[doc = "Disables protection."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + disable_protection_input: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + disable_protection_input: disable_protection_input.into(), + } + } + #[doc = "Removes disk(s)."] + pub fn remove_disks( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + remove_disks_input: impl Into, + ) -> remove_disks::Builder { + remove_disks::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + remove_disks_input: remove_disks_input.into(), + } + } + #[doc = "Resynchronize or repair replication."] + pub fn repair_replication( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> repair_replication::Builder { + repair_replication::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Execute Reverse Replication\\Reprotect."] + pub fn reprotect( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + reprotect_input: impl Into, + ) -> reprotect::Builder { + reprotect::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + reprotect_input: reprotect_input.into(), + } + } + #[doc = "Resolve health errors."] + pub fn resolve_health_errors( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + resolve_health_input: impl Into, + ) -> resolve_health_errors::Builder { + resolve_health_errors::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + resolve_health_input: resolve_health_input.into(), + } + } + #[doc = "Execute test failover."] + pub fn test_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + testfailover_input: impl Into, + ) -> test_failover::Builder { + test_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + testfailover_input: testfailover_input.into(), + } + } + #[doc = "Execute test failover cleanup."] + pub fn test_failover_cleanup( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + cleanup_input: impl Into, + ) -> test_failover_cleanup::Builder { + test_failover_cleanup::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + cleanup_input: cleanup_input.into(), + } + } + #[doc = "Execute unplanned failover."] + pub fn unplanned_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + failover_input: impl Into, + ) -> unplanned_failover::Builder { + unplanned_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + failover_input: failover_input.into(), + } + } + #[doc = "Updates appliance for replication protected Item."] + pub fn update_appliance( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + appliance_update_input: impl Into, + ) -> update_appliance::Builder { + update_appliance::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + appliance_update_input: appliance_update_input.into(), + } + } + #[doc = "Update the mobility service on a protected item."] + pub fn update_mobility_service( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replication_protected_item_name: impl Into, + update_mobility_service_request: impl Into, + ) -> update_mobility_service::Builder { + update_mobility_service::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replication_protected_item_name: replication_protected_item_name.into(), + update_mobility_service_request: update_mobility_service_request.into(), + } + } + #[doc = "Gets the list of replication protected items."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + skip_token: None, + filter: None, + } + } + } + pub mod list_by_replication_protection_containers { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) input: models::EnableProtectionInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) update_protection_input: models::UpdateReplicationProtectedItemInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_protection_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod purge { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod add_disks { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) add_disks_input: models::AddDisksInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/addDisks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.add_disks_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod apply_recovery_point { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) apply_recovery_point_input: models::ApplyRecoveryPointInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/applyRecoveryPoint" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.apply_recovery_point_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_cancel { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/failoverCancel" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_commit { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/failoverCommit" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod planned_failover { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) failover_input: models::PlannedFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/plannedFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.failover_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) disable_protection_input: models::DisableProtectionInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/remove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.disable_protection_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod remove_disks { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) remove_disks_input: models::RemoveDisksInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/removeDisks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.remove_disks_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod repair_replication { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/repairReplication" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reprotect { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) reprotect_input: models::ReverseReplicationInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/reProtect" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.reprotect_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod resolve_health_errors { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) resolve_health_input: models::ResolveHealthInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/resolveHealthErrors" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resolve_health_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_failover { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) testfailover_input: models::TestFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/testFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.testfailover_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_failover_cleanup { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) cleanup_input: models::TestFailoverCleanupInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/testFailoverCleanup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.cleanup_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod unplanned_failover { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) failover_input: models::UnplannedFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/unplannedFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.failover_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_appliance { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) appliance_update_input: models::UpdateApplianceForReplicationProtectedItemInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/updateAppliance" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.appliance_update_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_mobility_service { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replication_protected_item_name: String, + pub(crate) update_mobility_service_request: models::UpdateMobilityServiceRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/updateMobilityService" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replication_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_mobility_service_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) skip_token: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectedItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("skipToken", skip_token); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of recovery points for a replication protected item."] + pub fn list_by_replication_protected_items( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> list_by_replication_protected_items::Builder { + list_by_replication_protected_items::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Gets a recovery point."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + recovery_point_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + recovery_point_name: recovery_point_name.into(), + } + } + } + pub mod list_by_replication_protected_items { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/recoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) recovery_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/recoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name , & self . recovery_point_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod target_compute_sizes { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of target compute sizes for the replication protected item."] + pub fn list_by_replication_protected_items( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> list_by_replication_protected_items::Builder { + list_by_replication_protected_items::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + } + pub mod list_by_replication_protected_items { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/targetComputeSizes" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TargetComputeSizeCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protection_container_mappings { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of protection container mappings for a protection container."] + pub fn list_by_replication_protection_containers( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> list_by_replication_protection_containers::Builder { + list_by_replication_protection_containers::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + } + } + #[doc = "Gets a protection container mapping."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + } + } + #[doc = "Create protection container mapping."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + creation_input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + creation_input: creation_input.into(), + } + } + #[doc = "Update protection container mapping."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + update_input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + update_input: update_input.into(), + } + } + #[doc = "Purge protection container mapping."] + pub fn purge( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + } + } + #[doc = "Remove protection container mapping."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + removal_input: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + removal_input: removal_input.into(), + } + } + #[doc = "Gets the list of all protection container mappings in a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_protection_containers { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainerMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + pub(crate) creation_input: models::CreateProtectionContainerMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.creation_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainerMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + pub(crate) update_input: models::UpdateProtectionContainerMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod purge { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + pub(crate) removal_input: models::RemoveProtectionContainerMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}/remove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.removal_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionContainerMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_recovery_services_providers { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of registered recovery services providers for the fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets the details of a recovery services provider."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + } + } + #[doc = "Adds a recovery services provider."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + add_provider_input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + add_provider_input: add_provider_input.into(), + } + } + #[doc = "Purges recovery service provider from fabric."] + pub fn purge( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + } + } + #[doc = "Refresh details from the recovery services provider."] + pub fn refresh_provider( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + ) -> refresh_provider::Builder { + refresh_provider::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + } + } + #[doc = "Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is unsupported. To maintain backward compatibility for released clients the object \"deleteRspInput\" is used (if the object is empty we assume that it is old client and continue the old behavior)."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + } + } + #[doc = "Gets the list of registered recovery services providers in the vault. This is a view only api."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryServicesProvider), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + pub(crate) add_provider_input: models::AddRecoveryServicesProviderInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.add_provider_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod purge { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod refresh_provider { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryServicesProvider), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}/refreshProvider" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}/remove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryServicesProviders" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_storage_classifications { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of storage classification objects under a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets the details of a storage classification."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + } + } + #[doc = "Gets the list of storage classification objects under a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassification = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationStorageClassifications" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_storage_classification_mappings { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of storage classification mappings objects under a storage."] + pub fn list_by_replication_storage_classifications( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + ) -> list_by_replication_storage_classifications::Builder { + list_by_replication_storage_classifications::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + } + } + #[doc = "Gets the details of a storage classification mapping."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + storage_classification_mapping_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + storage_classification_mapping_name: storage_classification_mapping_name.into(), + } + } + #[doc = "Create storage classification mapping."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + storage_classification_mapping_name: impl Into, + pairing_input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + storage_classification_mapping_name: storage_classification_mapping_name.into(), + pairing_input: pairing_input.into(), + } + } + #[doc = "Delete a storage classification mapping."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + storage_classification_mapping_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + storage_classification_mapping_name: storage_classification_mapping_name.into(), + } + } + #[doc = "Gets the list of storage classification mappings objects under a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_storage_classifications { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}/replicationStorageClassificationMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + pub(crate) storage_classification_mapping_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}/replicationStorageClassificationMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name , & self . storage_classification_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::StorageClassificationMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + pub(crate) storage_classification_mapping_name: String, + pub(crate) pairing_input: models::StorageClassificationMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}/replicationStorageClassificationMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name , & self . storage_classification_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.pairing_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + pub(crate) storage_classification_mapping_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}/replicationStorageClassificationMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name , & self . storage_classification_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationStorageClassificationMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replicationv_centers { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of vCenter registered under a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets the details of a vCenter."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + vcenter_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + vcenter_name: vcenter_name.into(), + } + } + #[doc = "Add vCenter."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + vcenter_name: impl Into, + add_v_center_request: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + vcenter_name: vcenter_name.into(), + add_v_center_request: add_v_center_request.into(), + } + } + #[doc = "Update vCenter operation."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + vcenter_name: impl Into, + update_v_center_request: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + vcenter_name: vcenter_name.into(), + update_v_center_request: update_v_center_request.into(), + } + } + #[doc = "Remove vcenter operation."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + vcenter_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + vcenter_name: vcenter_name.into(), + } + } + #[doc = "Gets the list of vCenter registered under the vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenterCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) vcenter_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . vcenter_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VCenter), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) vcenter_name: String, + pub(crate) add_v_center_request: models::AddVCenterRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . vcenter_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.add_v_center_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VCenter), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) vcenter_name: String, + pub(crate) update_v_center_request: models::UpdateVCenterRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . vcenter_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_v_center_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) vcenter_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . vcenter_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationvCenters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenterCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_jobs { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of jobs."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + #[doc = "Gets the job details."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + #[doc = "Cancels the specified job."] + pub fn cancel( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> cancel::Builder { + cancel::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + #[doc = "Restarts the specified job."] + pub fn restart( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + #[doc = "Resumes the specified job."] + pub fn resume( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + resume_job_params: impl Into, + ) -> resume::Builder { + resume::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + resume_job_params: resume_job_params.into(), + } + } + #[doc = "Exports the details of the Azure Site Recovery jobs of the vault."] + pub fn export( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_query_parameter: impl Into, + ) -> export::Builder { + export::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_query_parameter: job_query_parameter.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod cancel { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Job), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/{}/cancel", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod restart { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Job), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/{}/restart", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod resume { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Job), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + pub(crate) resume_job_params: models::ResumeJobParams, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/{}/resume", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resume_job_params).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod export { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Job), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_query_parameter: models::JobQueryParameter, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/export", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.job_query_parameter).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_policies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of replication policies."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the requested policy."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + } + } + #[doc = "Creates the policy."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + input: input.into(), + } + } + #[doc = "Updates the policy."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + input: input.into(), + } + } + #[doc = "Delete the policy."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Policy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Policy), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) input: models::CreatePolicyInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Policy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::Policy), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) input: models::UpdatePolicyInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Policy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protection_intents { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of replication protection intent objects."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + skip_token: None, + take_token: None, + } + } + #[doc = "Gets the details of a Replication protection intent item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + intent_object_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + intent_object_name: intent_object_name.into(), + } + } + #[doc = "Create protection intent Resource."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + intent_object_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + intent_object_name: intent_object_name.into(), + input: input.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) skip_token: Option, + pub(crate) take_token: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn take_token(mut self, take_token: impl Into) -> Self { + self.take_token = Some(take_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionIntents", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("skipToken", skip_token); + } + if let Some(take_token) = &self.take_token { + url.query_pairs_mut().append_pair("takeToken", take_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectionIntentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) intent_object_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionIntents/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectionIntent = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) intent_object_name: String, + pub(crate) input: models::CreateProtectionIntentInput, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionIntents/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectionIntent = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_recovery_plans { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of recovery plans."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the requested recovery plan."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Creates a recovery plan with the given details."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Updates the given recovery plan."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Deletes the specified recovery plan."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Execute cancel failover of the recovery plan."] + pub fn failover_cancel( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> failover_cancel::Builder { + failover_cancel::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Execute commit failover of the recovery plan."] + pub fn failover_commit( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> failover_commit::Builder { + failover_commit::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Execute planned failover of the recovery plan."] + pub fn planned_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> planned_failover::Builder { + planned_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Execute reprotect of the recovery plan."] + pub fn reprotect( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> reprotect::Builder { + reprotect::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Execute test failover of the recovery plan."] + pub fn test_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> test_failover::Builder { + test_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Execute test failover cleanup of the recovery plan."] + pub fn test_failover_cleanup( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> test_failover_cleanup::Builder { + test_failover_cleanup::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Execute unplanned failover of the recovery plan."] + pub fn unplanned_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> unplanned_failover::Builder { + unplanned_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlanCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.recovery_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::CreateRecoveryPlanInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.recovery_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::UpdateRecoveryPlanInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.recovery_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.recovery_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_cancel { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/failoverCancel" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_commit { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/failoverCommit" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod planned_failover { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::RecoveryPlanPlannedFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/plannedFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reprotect { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/reProtect" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_failover { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::RecoveryPlanTestFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/testFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_failover_cleanup { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::RecoveryPlanTestFailoverCleanupInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/testFailoverCleanup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod unplanned_failover { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::RecoveryPlanUnplannedFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/unplannedFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod supported_operating_systems { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the data of supported operating systems by SRS."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + instance_type: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) instance_type: Option, + } + impl Builder { + pub fn instance_type(mut self, instance_type: impl Into) -> Self { + self.instance_type = Some(instance_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationSupportedOperatingSystems" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(instance_type) = &self.instance_type { + url.query_pairs_mut().append_pair("instanceType", instance_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SupportedOperatingSystems = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_vault_health { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the health summary for the vault."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Refreshes health summary of the vault."] + pub fn refresh( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> refresh::Builder { + refresh::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultHealth", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultHealthDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod refresh { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::VaultHealthDetails), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultHealth/default/refresh" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultHealthDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_vault_setting { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of vault setting."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the vault setting."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + vault_setting_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + vault_setting_name: vault_setting_name.into(), + } + } + #[doc = "Updates vault setting. A vault setting object is a singleton per vault and it is always present by default."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + vault_setting_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + vault_setting_name: vault_setting_name.into(), + input: input.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultSettings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultSettingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) vault_setting_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultSettings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.vault_setting_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultSetting = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) vault_setting_name: String, + pub(crate) input: models::VaultSettingCreationInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultSettings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.vault_setting_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultSetting = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/redis/Cargo.toml b/services/mgmt/redis/Cargo.toml index f0f90e8f79..34fc0f5344 100644 --- a/services/mgmt/redis/Cargo.toml +++ b/services/mgmt/redis/Cargo.toml @@ -19,10 +19,11 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2020-12", "enable_reqwest"] +default = ["package-2021-06", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-06" = [] "package-2020-12" = [] "package-2020-06" = [] "package-2019-07-preview" = [] diff --git a/services/mgmt/redis/src/lib.rs b/services/mgmt/redis/src/lib.rs index 10470caa1a..a2ba7f059f 100644 --- a/services/mgmt/redis/src/lib.rs +++ b/services/mgmt/redis/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-06")] +pub mod package_2021_06; +#[cfg(all(feature = "package-2021-06", not(feature = "no-default-version")))] +pub use package_2021_06::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2020-12")] pub mod package_2020_12; #[cfg(all(feature = "package-2020-12", not(feature = "no-default-version")))] diff --git a/services/mgmt/redis/src/package_2021_06/mod.rs b/services/mgmt/redis/src/package_2021_06/mod.rs new file mode 100644 index 0000000000..40e15441b6 --- /dev/null +++ b/services/mgmt/redis/src/package_2021_06/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-06-01"; diff --git a/services/mgmt/redis/src/package_2021_06/models.rs b/services/mgmt/redis/src/package_2021_06/models.rs new file mode 100644 index 0000000000..6ad541ed5c --- /dev/null +++ b/services/mgmt/redis/src/package_2021_06/models.rs @@ -0,0 +1,567 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityParameters { + pub name: String, + #[serde(rename = "type")] + pub type_: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportRdbParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + pub prefix: String, + pub container: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportRdbParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + pub files: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedServiceIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "type")] + pub type_: ManagedServiceIdentityType, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ManagedServiceIdentityType { + None, + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotificationListResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointConnectionProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointServiceConnectionStatus { + Pending, + Approved, + Rejected, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceProperties { + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionState { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisAccessKeys { + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisCommonProperties { + #[serde(rename = "redisConfiguration", default, skip_serializing_if = "Option::is_none")] + pub redis_configuration: Option, + #[serde(rename = "redisVersion", default, skip_serializing_if = "Option::is_none")] + pub redis_version: Option, + #[serde(rename = "enableNonSslPort", default, skip_serializing_if = "Option::is_none")] + pub enable_non_ssl_port: Option, + #[serde(rename = "replicasPerMaster", default, skip_serializing_if = "Option::is_none")] + pub replicas_per_master: Option, + #[serde(rename = "replicasPerPrimary", default, skip_serializing_if = "Option::is_none")] + pub replicas_per_primary: Option, + #[serde(rename = "tenantSettings", default, skip_serializing_if = "Option::is_none")] + pub tenant_settings: Option, + #[serde(rename = "shardCount", default, skip_serializing_if = "Option::is_none")] + pub shard_count: Option, + #[serde(rename = "minimumTlsVersion", default, skip_serializing_if = "Option::is_none")] + pub minimum_tls_version: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +pub mod redis_common_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct RedisConfiguration { + #[serde(rename = "rdb-backup-enabled", default, skip_serializing_if = "Option::is_none")] + pub rdb_backup_enabled: Option, + #[serde(rename = "rdb-backup-frequency", default, skip_serializing_if = "Option::is_none")] + pub rdb_backup_frequency: Option, + #[serde(rename = "rdb-backup-max-snapshot-count", default, skip_serializing_if = "Option::is_none")] + pub rdb_backup_max_snapshot_count: Option, + #[serde(rename = "rdb-storage-connection-string", default, skip_serializing_if = "Option::is_none")] + pub rdb_storage_connection_string: Option, + #[serde(rename = "aof-storage-connection-string-0", default, skip_serializing_if = "Option::is_none")] + pub aof_storage_connection_string_0: Option, + #[serde(rename = "aof-storage-connection-string-1", default, skip_serializing_if = "Option::is_none")] + pub aof_storage_connection_string_1: Option, + #[serde(rename = "maxfragmentationmemory-reserved", default, skip_serializing_if = "Option::is_none")] + pub maxfragmentationmemory_reserved: Option, + #[serde(rename = "maxmemory-policy", default, skip_serializing_if = "Option::is_none")] + pub maxmemory_policy: Option, + #[serde(rename = "maxmemory-reserved", default, skip_serializing_if = "Option::is_none")] + pub maxmemory_reserved: Option, + #[serde(rename = "maxmemory-delta", default, skip_serializing_if = "Option::is_none")] + pub maxmemory_delta: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maxclients: Option, + #[serde(rename = "preferred-data-archive-auth-method", default, skip_serializing_if = "Option::is_none")] + pub preferred_data_archive_auth_method: Option, + #[serde( + rename = "preferred-data-persistence-auth-method", + default, + skip_serializing_if = "Option::is_none" + )] + pub preferred_data_persistence_auth_method: Option, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MinimumTlsVersion { + #[serde(rename = "1.0")] + N1_0, + #[serde(rename = "1.1")] + N1_1, + #[serde(rename = "1.2")] + N1_2, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisCreateParameters { + pub properties: RedisCreateProperties, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisCreateProperties { + #[serde(flatten)] + pub redis_common_properties: RedisCommonProperties, + pub sku: Sku, + #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] + pub subnet_id: Option, + #[serde(rename = "staticIP", default, skip_serializing_if = "Option::is_none")] + pub static_ip: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisFirewallRule { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub properties: RedisFirewallRuleProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisFirewallRuleCreateParameters { + #[serde(flatten)] + pub redis_firewall_rule: RedisFirewallRule, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisFirewallRuleListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisFirewallRuleProperties { + #[serde(rename = "startIP")] + pub start_ip: String, + #[serde(rename = "endIP")] + pub end_ip: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisForceRebootResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisInstanceDetails { + #[serde(rename = "sslPort", default, skip_serializing_if = "Option::is_none")] + pub ssl_port: Option, + #[serde(rename = "nonSslPort", default, skip_serializing_if = "Option::is_none")] + pub non_ssl_port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub zone: Option, + #[serde(rename = "shardId", default, skip_serializing_if = "Option::is_none")] + pub shard_id: Option, + #[serde(rename = "isMaster", default, skip_serializing_if = "Option::is_none")] + pub is_master: Option, + #[serde(rename = "isPrimary", default, skip_serializing_if = "Option::is_none")] + pub is_primary: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisLinkedServer { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisLinkedServerCreateParameters { + pub properties: RedisLinkedServerCreateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisLinkedServerCreateProperties { + #[serde(rename = "linkedRedisCacheId")] + pub linked_redis_cache_id: String, + #[serde(rename = "linkedRedisCacheLocation")] + pub linked_redis_cache_location: String, + #[serde(rename = "serverRole")] + pub server_role: redis_linked_server_create_properties::ServerRole, +} +pub mod redis_linked_server_create_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServerRole { + Primary, + Secondary, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisLinkedServerProperties { + #[serde(flatten)] + pub redis_linked_server_create_properties: RedisLinkedServerCreateProperties, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisLinkedServerWithProperties { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisLinkedServerWithPropertiesList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisPatchSchedule { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub properties: ScheduleEntries, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisPatchScheduleListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisProperties { + #[serde(flatten)] + pub redis_create_properties: RedisCreateProperties, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "sslPort", default, skip_serializing_if = "Option::is_none")] + pub ssl_port: Option, + #[serde(rename = "accessKeys", default, skip_serializing_if = "Option::is_none")] + pub access_keys: Option, + #[serde(rename = "linkedServers", default, skip_serializing_if = "Vec::is_empty")] + pub linked_servers: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub instances: Vec, + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, +} +pub mod redis_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Deleting, + Disabled, + Failed, + Linking, + Provisioning, + RecoveringScaleFailure, + Scaling, + Succeeded, + Unlinking, + Unprovisioning, + Updating, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisRebootParameters { + #[serde(rename = "rebootType", default, skip_serializing_if = "Option::is_none")] + pub reboot_type: Option, + #[serde(rename = "shardId", default, skip_serializing_if = "Option::is_none")] + pub shard_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ports: Vec, +} +pub mod redis_reboot_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RebootType { + PrimaryNode, + SecondaryNode, + AllNodes, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisRegenerateKeyParameters { + #[serde(rename = "keyType")] + pub key_type: redis_regenerate_key_parameters::KeyType, +} +pub mod redis_regenerate_key_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyType { + Primary, + Secondary, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisResource { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + pub properties: RedisProperties, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedisUpdateProperties { + #[serde(flatten)] + pub redis_common_properties: RedisCommonProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleEntries { + #[serde(rename = "scheduleEntries")] + pub schedule_entries: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleEntry { + #[serde(rename = "dayOfWeek")] + pub day_of_week: schedule_entry::DayOfWeek, + #[serde(rename = "startHourUtc")] + pub start_hour_utc: i32, + #[serde(rename = "maintenanceWindow", default, skip_serializing_if = "Option::is_none")] + pub maintenance_window: Option, +} +pub mod schedule_entry { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DayOfWeek { + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, + Sunday, + Everyday, + Weekend, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + pub name: sku::Name, + pub family: sku::Family, + pub capacity: i32, +} +pub mod sku { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + Standard, + Premium, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Family { + C, + P, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradeNotification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + #[serde(rename = "upsellNotification", default, skip_serializing_if = "Option::is_none")] + pub upsell_notification: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentities {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentity { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} diff --git a/services/mgmt/redis/src/package_2021_06/operations.rs b/services/mgmt/redis/src/package_2021_06/operations.rs new file mode 100644 index 0000000000..a9f95238f2 --- /dev/null +++ b/services/mgmt/redis/src/package_2021_06/operations.rs @@ -0,0 +1,3117 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn firewall_rules(&self) -> firewall_rules::Client { + firewall_rules::Client(self.clone()) + } + pub fn linked_server(&self) -> linked_server::Client { + linked_server::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn patch_schedules(&self) -> patch_schedules::Client { + patch_schedules::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn redis(&self) -> redis::Client { + redis::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Redis_CheckNameAvailability(#[from] redis::check_name_availability::Error), + #[error(transparent)] + Redis_ListUpgradeNotifications(#[from] redis::list_upgrade_notifications::Error), + #[error(transparent)] + Redis_Get(#[from] redis::get::Error), + #[error(transparent)] + Redis_Create(#[from] redis::create::Error), + #[error(transparent)] + Redis_Update(#[from] redis::update::Error), + #[error(transparent)] + Redis_Delete(#[from] redis::delete::Error), + #[error(transparent)] + Redis_ListByResourceGroup(#[from] redis::list_by_resource_group::Error), + #[error(transparent)] + Redis_ListBySubscription(#[from] redis::list_by_subscription::Error), + #[error(transparent)] + Redis_ListKeys(#[from] redis::list_keys::Error), + #[error(transparent)] + Redis_RegenerateKey(#[from] redis::regenerate_key::Error), + #[error(transparent)] + Redis_ForceReboot(#[from] redis::force_reboot::Error), + #[error(transparent)] + Redis_ImportData(#[from] redis::import_data::Error), + #[error(transparent)] + Redis_ExportData(#[from] redis::export_data::Error), + #[error(transparent)] + FirewallRules_List(#[from] firewall_rules::list::Error), + #[error(transparent)] + FirewallRules_Get(#[from] firewall_rules::get::Error), + #[error(transparent)] + FirewallRules_CreateOrUpdate(#[from] firewall_rules::create_or_update::Error), + #[error(transparent)] + FirewallRules_Delete(#[from] firewall_rules::delete::Error), + #[error(transparent)] + PatchSchedules_ListByRedisResource(#[from] patch_schedules::list_by_redis_resource::Error), + #[error(transparent)] + PatchSchedules_Get(#[from] patch_schedules::get::Error), + #[error(transparent)] + PatchSchedules_CreateOrUpdate(#[from] patch_schedules::create_or_update::Error), + #[error(transparent)] + PatchSchedules_Delete(#[from] patch_schedules::delete::Error), + #[error(transparent)] + LinkedServer_Get(#[from] linked_server::get::Error), + #[error(transparent)] + LinkedServer_Create(#[from] linked_server::create::Error), + #[error(transparent)] + LinkedServer_Delete(#[from] linked_server::delete::Error), + #[error(transparent)] + LinkedServer_List(#[from] linked_server::list::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Put(#[from] private_endpoint_connections::put::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + PrivateLinkResources_ListByRedisCache(#[from] private_link_resources::list_by_redis_cache::Error), +} +pub mod operations { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Cache/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod redis { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + parameters: impl Into, + subscription_id: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_upgrade_notifications( + &self, + resource_group_name: impl Into, + name: impl Into, + subscription_id: impl Into, + history: f64, + ) -> list_upgrade_notifications::Builder { + list_upgrade_notifications::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + history, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + name: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_key( + &self, + resource_group_name: impl Into, + name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> regenerate_key::Builder { + regenerate_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn force_reboot( + &self, + resource_group_name: impl Into, + name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> force_reboot::Builder { + force_reboot::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn import_data( + &self, + resource_group_name: impl Into, + name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> import_data::Builder { + import_data::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn export_data( + &self, + resource_group_name: impl Into, + name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> export_data::Builder { + export_data::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod check_name_availability { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::CheckNameAvailabilityParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Cache/CheckNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_upgrade_notifications { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) history: f64, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/listUpgradeNotifications", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let history = &self.history; + url.query_pairs_mut().append_pair("history", &history.to_string()); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotificationListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Created201(models::RedisResource), + Ok200(models::RedisResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) parameters: models::RedisCreateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) parameters: models::RedisUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Cache/redis", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_keys { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/listKeys", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisAccessKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_key { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) parameters: models::RedisRegenerateKeyParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/regenerateKey", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisAccessKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod force_reboot { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) parameters: models::RedisRebootParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/forceReboot", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisForceRebootResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod import_data { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) parameters: models::ImportRdbParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/import", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod export_data { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) parameters: models::ExportRdbParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/export", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod firewall_rules { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cache_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + cache_name: impl Into, + rule_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + rule_name: rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + cache_name: impl Into, + rule_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + rule_name: rule_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + cache_name: impl Into, + rule_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + rule_name: rule_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/firewallRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisFirewallRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + pub(crate) rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/firewallRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisFirewallRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RedisFirewallRule), + Created201(models::RedisFirewallRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + pub(crate) rule_name: String, + pub(crate) parameters: models::RedisFirewallRule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/firewallRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisFirewallRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisFirewallRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + pub(crate) rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/firewallRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod patch_schedules { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_redis_resource( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cache_name: impl Into, + ) -> list_by_redis_resource::Builder { + list_by_redis_resource::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + name: impl Into, + default: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + default: default.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + name: impl Into, + default: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + default: default.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + name: impl Into, + default: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + default: default.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_redis_resource { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/patchSchedules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisPatchScheduleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) default: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/patchSchedules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name, + &self.default + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisPatchSchedule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RedisPatchSchedule), + Created201(models::RedisPatchSchedule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) default: String, + pub(crate) parameters: models::RedisPatchSchedule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/patchSchedules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name, + &self.default + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisPatchSchedule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisPatchSchedule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) default: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/patchSchedules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name, + &self.default + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod linked_server { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + name: impl Into, + linked_server_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + linked_server_name: linked_server_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + name: impl Into, + linked_server_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + linked_server_name: linked_server_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + name: impl Into, + linked_server_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + linked_server_name: linked_server_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) linked_server_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/linkedServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name, + &self.linked_server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisLinkedServerWithProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::RedisLinkedServerWithProperties), + Created201(models::RedisLinkedServerWithProperties), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) linked_server_name: String, + pub(crate) parameters: models::RedisLinkedServerCreateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/linkedServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name, + &self.linked_server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisLinkedServerWithProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisLinkedServerWithProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) linked_server_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/linkedServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name, + &self.linked_server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/linkedServers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RedisLinkedServerWithPropertiesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + cache_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + cache_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn put( + &self, + resource_group_name: impl Into, + cache_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + properties: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + properties: properties.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + cache_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/privateEndpointConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) properties: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_redis_cache( + &self, + resource_group_name: impl Into, + cache_name: impl Into, + subscription_id: impl Into, + ) -> list_by_redis_cache::Builder { + list_by_redis_cache::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cache_name: cache_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_redis_cache { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cache_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Cache/redis/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cache_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/reservations/src/package_preview_2019_04/models.rs b/services/mgmt/reservations/src/package_preview_2019_04/models.rs index 46118d7339..37e3a5add8 100644 --- a/services/mgmt/reservations/src/package_preview_2019_04/models.rs +++ b/services/mgmt/reservations/src/package_preview_2019_04/models.rs @@ -26,6 +26,15 @@ pub struct AppliedReservationsProperties { pub reservation_order_ids: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppliedScopeProperties { + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "managementGroupId", default, skip_serializing_if = "Option::is_none")] + pub management_group_id: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum AppliedScopeType { Single, Shared, @@ -95,6 +104,8 @@ pub struct Catalog { pub name: Option, #[serde(rename = "billingPlans", default, skip_serializing_if = "Option::is_none")] pub billing_plans: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub msrp: Option, #[serde(default, skip_serializing_if = "Vec::is_empty")] pub terms: Vec, #[serde(default, skip_serializing_if = "Vec::is_empty")] @@ -198,6 +209,13 @@ pub struct MergeRequest { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MsrpProperty { + #[serde(rename = "currencyCode", default, skip_serializing_if = "Option::is_none")] + pub currency_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub amount: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationDisplay { #[serde(default, skip_serializing_if = "Option::is_none")] pub provider: Option, @@ -462,6 +480,10 @@ pub struct ReservationProperties { pub split_properties: Option, #[serde(rename = "mergeProperties", default, skip_serializing_if = "Option::is_none")] pub merge_properties: Option, + #[serde(rename = "swapProperties", default, skip_serializing_if = "Option::is_none")] + pub swap_properties: Option, + #[serde(rename = "appliedScopeProperties", default, skip_serializing_if = "Option::is_none")] + pub applied_scope_properties: Option, #[serde(rename = "billingScopeId", default, skip_serializing_if = "Option::is_none")] pub billing_scope_id: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -517,6 +539,13 @@ pub enum ReservationStatusCode { Succeeded, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReservationSwapProperties { + #[serde(rename = "swapSource", default, skip_serializing_if = "Option::is_none")] + pub swap_source: Option, + #[serde(rename = "swapDestination", default, skip_serializing_if = "Option::is_none")] + pub swap_destination: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum ReservationTerm { #[serde(rename = "P1Y")] P1y, diff --git a/services/mgmt/reservations/src/package_preview_2019_07_19/models.rs b/services/mgmt/reservations/src/package_preview_2019_07_19/models.rs index d5e8e415f4..20ecdb40de 100644 --- a/services/mgmt/reservations/src/package_preview_2019_07_19/models.rs +++ b/services/mgmt/reservations/src/package_preview_2019_07_19/models.rs @@ -31,6 +31,15 @@ pub struct AppliedReservationsProperties { pub reservation_order_ids: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppliedScopeProperties { + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "managementGroupId", default, skip_serializing_if = "Option::is_none")] + pub management_group_id: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum AppliedScopeType { Single, Shared, @@ -118,6 +127,8 @@ pub struct Catalog { pub name: Option, #[serde(rename = "billingPlans", default, skip_serializing_if = "Option::is_none")] pub billing_plans: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub msrp: Option, #[serde(default, skip_serializing_if = "Vec::is_empty")] pub terms: Vec, #[serde(default, skip_serializing_if = "Vec::is_empty")] @@ -258,6 +269,13 @@ pub struct MergeRequest { pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MsrpProperty { + #[serde(rename = "currencyCode", default, skip_serializing_if = "Option::is_none")] + pub currency_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub amount: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationDisplay { #[serde(default, skip_serializing_if = "Option::is_none")] pub provider: Option, @@ -637,6 +655,10 @@ pub struct ReservationProperties { pub split_properties: Option, #[serde(rename = "mergeProperties", default, skip_serializing_if = "Option::is_none")] pub merge_properties: Option, + #[serde(rename = "swapProperties", default, skip_serializing_if = "Option::is_none")] + pub swap_properties: Option, + #[serde(rename = "appliedScopeProperties", default, skip_serializing_if = "Option::is_none")] + pub applied_scope_properties: Option, #[serde(rename = "billingScopeId", default, skip_serializing_if = "Option::is_none")] pub billing_scope_id: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -692,6 +714,13 @@ pub enum ReservationStatusCode { Succeeded, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReservationSwapProperties { + #[serde(rename = "swapSource", default, skip_serializing_if = "Option::is_none")] + pub swap_source: Option, + #[serde(rename = "swapDestination", default, skip_serializing_if = "Option::is_none")] + pub swap_destination: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum ReservationTerm { #[serde(rename = "P1Y")] P1y, diff --git a/services/mgmt/resourcehealth/src/package_2020_05_01/models.rs b/services/mgmt/resourcehealth/src/package_2020_05_01/models.rs index 56e9ace9b2..f3d77af0d8 100644 --- a/services/mgmt/resourcehealth/src/package_2020_05_01/models.rs +++ b/services/mgmt/resourcehealth/src/package_2020_05_01/models.rs @@ -48,6 +48,8 @@ pub mod availability_status { #[serde(rename = "availabilityState", default, skip_serializing_if = "Option::is_none")] pub availability_state: Option, #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] pub summary: Option, #[serde(rename = "detailedStatus", default, skip_serializing_if = "Option::is_none")] pub detailed_status: Option, diff --git a/services/mgmt/resourcehealth/src/package_2020_05_01_preview/models.rs b/services/mgmt/resourcehealth/src/package_2020_05_01_preview/models.rs index 88cba83e59..628555c386 100644 --- a/services/mgmt/resourcehealth/src/package_2020_05_01_preview/models.rs +++ b/services/mgmt/resourcehealth/src/package_2020_05_01_preview/models.rs @@ -48,6 +48,8 @@ pub mod availability_status { #[serde(rename = "availabilityState", default, skip_serializing_if = "Option::is_none")] pub availability_state: Option, #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] pub summary: Option, #[serde(rename = "detailedStatus", default, skip_serializing_if = "Option::is_none")] pub detailed_status: Option, diff --git a/services/mgmt/resourcemover/Cargo.toml b/services/mgmt/resourcemover/Cargo.toml index 6e244c09bb..7b0b7f6182 100644 --- a/services/mgmt/resourcemover/Cargo.toml +++ b/services/mgmt/resourcemover/Cargo.toml @@ -19,9 +19,10 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2021-01-01", "enable_reqwest"] +default = ["package-2021-08-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-2021-08-01" = [] "package-2019-10-01-preview" = [] "package-2021-01-01" = [] diff --git a/services/mgmt/resourcemover/src/lib.rs b/services/mgmt/resourcemover/src/lib.rs index f7594b8725..e782f34f3a 100644 --- a/services/mgmt/resourcemover/src/lib.rs +++ b/services/mgmt/resourcemover/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-08-01")] +pub mod package_2021_08_01; +#[cfg(all(feature = "package-2021-08-01", not(feature = "no-default-version")))] +pub use package_2021_08_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2019-10-01-preview")] pub mod package_2019_10_01_preview; #[cfg(all(feature = "package-2019-10-01-preview", not(feature = "no-default-version")))] diff --git a/services/mgmt/resourcemover/src/package_2021_08_01/mod.rs b/services/mgmt/resourcemover/src/package_2021_08_01/mod.rs new file mode 100644 index 0000000000..fdc89d4415 --- /dev/null +++ b/services/mgmt/resourcemover/src/package_2021_08_01/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-08-01"; diff --git a/services/mgmt/resourcemover/src/package_2021_08_01/models.rs b/services/mgmt/resourcemover/src/package_2021_08_01/models.rs new file mode 100644 index 0000000000..e8a78d58bc --- /dev/null +++ b/services/mgmt/resourcemover/src/package_2021_08_01/models.rs @@ -0,0 +1,721 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AffectedMoveResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "sourceId", default, skip_serializing_if = "Option::is_none")] + pub source_id: Option, + #[serde(rename = "moveResources", default, skip_serializing_if = "Vec::is_empty")] + pub move_resources: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomaticResolutionProperties { + #[serde(rename = "moveResourceId", default, skip_serializing_if = "Option::is_none")] + pub move_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailabilitySetResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "faultDomain", default, skip_serializing_if = "Option::is_none")] + pub fault_domain: Option, + #[serde(rename = "updateDomain", default, skip_serializing_if = "Option::is_none")] + pub update_domain: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceReference { + #[serde(rename = "sourceArmResourceId")] + pub source_arm_resource_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BulkRemoveRequest { + #[serde(rename = "validateOnly", default, skip_serializing_if = "Option::is_none")] + pub validate_only: Option, + #[serde(rename = "moveResources", default, skip_serializing_if = "Vec::is_empty")] + pub move_resources: Vec, + #[serde(rename = "moveResourceInputType", default, skip_serializing_if = "Option::is_none")] + pub move_resource_input_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommitRequest { + #[serde(rename = "validateOnly", default, skip_serializing_if = "Option::is_none")] + pub validate_only: Option, + #[serde(rename = "moveResources")] + pub move_resources: Vec, + #[serde(rename = "moveResourceInputType", default, skip_serializing_if = "Option::is_none")] + pub move_resource_input_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DependencyType { + RequiredForPrepare, + RequiredForMove, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiscardRequest { + #[serde(rename = "validateOnly", default, skip_serializing_if = "Option::is_none")] + pub validate_only: Option, + #[serde(rename = "moveResources")] + pub move_resources: Vec, + #[serde(rename = "moveResourceInputType", default, skip_serializing_if = "Option::is_none")] + pub move_resource_input_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskEncryptionSetResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Display { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Identity { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum JobName { + InitialSync, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatus { + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, + #[serde(rename = "jobProgress", default, skip_serializing_if = "Option::is_none")] + pub job_progress: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LbBackendAddressPoolResourceSettings { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LbFrontendIpConfigurationResourceSettings { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "privateIpAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[serde(rename = "privateIpAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub zones: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancerBackendAddressPoolReference { + #[serde(flatten)] + pub proxy_resource_reference: ProxyResourceReference, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancerNatRuleReference { + #[serde(flatten)] + pub proxy_resource_reference: ProxyResourceReference, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancerResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "frontendIPConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub frontend_ip_configurations: Vec, + #[serde(rename = "backendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub backend_address_pools: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub zones: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManualResolutionProperties { + #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")] + pub target_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveCollection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveCollectionProperties { + #[serde(rename = "sourceRegion")] + pub source_region: String, + #[serde(rename = "targetRegion")] + pub target_region: String, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub errors: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveCollectionResultList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveErrorInfo { + #[serde(rename = "moveResources", default, skip_serializing_if = "Vec::is_empty")] + pub move_resources: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(rename = "summaryCollection", default, skip_serializing_if = "Option::is_none")] + pub summary_collection: Option, + #[serde(rename = "totalCount", default, skip_serializing_if = "Option::is_none")] + pub total_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceDependency { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "resolutionStatus", default, skip_serializing_if = "Option::is_none")] + pub resolution_status: Option, + #[serde(rename = "resolutionType", default, skip_serializing_if = "Option::is_none")] + pub resolution_type: Option, + #[serde(rename = "dependencyType", default, skip_serializing_if = "Option::is_none")] + pub dependency_type: Option, + #[serde(rename = "manualResolution", default, skip_serializing_if = "Option::is_none")] + pub manual_resolution: Option, + #[serde(rename = "automaticResolution", default, skip_serializing_if = "Option::is_none")] + pub automatic_resolution: Option, + #[serde(rename = "isOptional", default, skip_serializing_if = "Option::is_none")] + pub is_optional: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceDependencyOverride { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")] + pub target_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceErrorBody { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceFilter { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceFilterProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum MoveResourceInputType { + MoveResourceId, + MoveResourceSourceId, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceProperties { + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "sourceId")] + pub source_id: String, + #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")] + pub target_id: Option, + #[serde(rename = "existingTargetId", default, skip_serializing_if = "Option::is_none")] + pub existing_target_id: Option, + #[serde(rename = "resourceSettings", default, skip_serializing_if = "Option::is_none")] + pub resource_settings: Option, + #[serde(rename = "sourceResourceSettings", default, skip_serializing_if = "Option::is_none")] + pub source_resource_settings: Option, + #[serde(rename = "moveStatus", default, skip_serializing_if = "Option::is_none")] + pub move_status: Option, + #[serde(rename = "dependsOn", default, skip_serializing_if = "Vec::is_empty")] + pub depends_on: Vec, + #[serde(rename = "dependsOnOverrides", default, skip_serializing_if = "Vec::is_empty")] + pub depends_on_overrides: Vec, + #[serde(rename = "isResolveRequired", default, skip_serializing_if = "Option::is_none")] + pub is_resolve_required: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub errors: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MoveResourceStatus { + #[serde(rename = "moveState", default, skip_serializing_if = "Option::is_none")] + pub move_state: Option, + #[serde(rename = "jobStatus", default, skip_serializing_if = "Option::is_none")] + pub job_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub errors: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum MoveState { + AssignmentPending, + PreparePending, + PrepareInProgress, + PrepareFailed, + MovePending, + MoveInProgress, + MoveFailed, + DiscardInProgress, + DiscardFailed, + CommitPending, + CommitInProgress, + CommitFailed, + Committed, + DeleteSourcePending, + ResourceMoveCompleted, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkInterfaceResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[serde(rename = "enableAcceleratedNetworking", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkSecurityGroupResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "securityRules", default, skip_serializing_if = "Vec::is_empty")] + pub security_rules: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NicIpConfigurationResourceSettings { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "privateIpAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[serde(rename = "privateIpAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "loadBalancerBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_backend_address_pools: Vec, + #[serde(rename = "loadBalancerNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_nat_rules: Vec, + #[serde(rename = "publicIp", default, skip_serializing_if = "Option::is_none")] + pub public_ip: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NsgReference { + #[serde(flatten)] + pub azure_resource_reference: AzureResourceReference, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NsgSecurityRule { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub access: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "destinationAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub destination_address_prefix: Option, + #[serde(rename = "destinationPortRange", default, skip_serializing_if = "Option::is_none")] + pub destination_port_range: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub direction: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[serde(rename = "sourceAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub source_address_prefix: Option, + #[serde(rename = "sourcePortRange", default, skip_serializing_if = "Option::is_none")] + pub source_port_range: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationErrorAdditionalInfo { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusProperties {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsDiscovery { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsDiscoveryCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsDiscoveryProperties {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrepareRequest { + #[serde(rename = "validateOnly", default, skip_serializing_if = "Option::is_none")] + pub validate_only: Option, + #[serde(rename = "moveResources")] + pub move_resources: Vec, + #[serde(rename = "moveResourceInputType", default, skip_serializing_if = "Option::is_none")] + pub move_resource_input_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + Succeeded, + Updating, + Creating, + Failed, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResourceReference { + #[serde(flatten)] + pub azure_resource_reference: AzureResourceReference, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PublicIpAddressResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "domainNameLabel", default, skip_serializing_if = "Option::is_none")] + pub domain_name_label: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[serde(rename = "publicIpAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub public_ip_allocation_method: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub zones: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PublicIpReference { + #[serde(flatten)] + pub azure_resource_reference: AzureResourceReference, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RequiredForResourcesCollection { + #[serde(rename = "sourceIds", default, skip_serializing_if = "Vec::is_empty")] + pub source_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ResolutionType { + Manual, + Automatic, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceGroupResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ResourceIdentityType { + None, + SystemAssigned, + UserAssigned, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceMoveRequest { + #[serde(rename = "validateOnly", default, skip_serializing_if = "Option::is_none")] + pub validate_only: Option, + #[serde(rename = "moveResources")] + pub move_resources: Vec, + #[serde(rename = "moveResourceInputType", default, skip_serializing_if = "Option::is_none")] + pub move_resource_input_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSettings { + #[serde(rename = "resourceType")] + pub resource_type: String, + #[serde(rename = "targetResourceName")] + pub target_resource_name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "zoneRedundant", default, skip_serializing_if = "Option::is_none")] + pub zone_redundant: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlElasticPoolResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "zoneRedundant", default, skip_serializing_if = "Option::is_none")] + pub zone_redundant: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubnetReference { + #[serde(flatten)] + pub proxy_resource_reference: ProxyResourceReference, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubnetResourceSettings { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[serde(rename = "networkSecurityGroup", default, skip_serializing_if = "Option::is_none")] + pub network_security_group: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Summary { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub item: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SummaryCollection { + #[serde(rename = "fieldName", default, skip_serializing_if = "Option::is_none")] + pub field_name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub summary: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnresolvedDependenciesFilter { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnresolvedDependenciesFilterProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnresolvedDependency { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnresolvedDependencyCollection { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(rename = "summaryCollection", default, skip_serializing_if = "Option::is_none")] + pub summary_collection: Option, + #[serde(rename = "totalCount", default, skip_serializing_if = "Option::is_none")] + pub total_count: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateMoveCollectionRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "userManagedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_managed_identities: Vec, + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, +} +pub mod virtual_machine_resource_settings { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TargetAvailabilityZone { + #[serde(rename = "1")] + N1, + #[serde(rename = "2")] + N2, + #[serde(rename = "3")] + N3, + #[serde(rename = "NA")] + Na, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkResourceSettings { + #[serde(flatten)] + pub resource_settings: ResourceSettings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(rename = "enableDdosProtection", default, skip_serializing_if = "Option::is_none")] + pub enable_ddos_protection: Option, + #[serde(rename = "addressSpace", default, skip_serializing_if = "Vec::is_empty")] + pub address_space: Vec, + #[serde(rename = "dnsServers", default, skip_serializing_if = "Vec::is_empty")] + pub dns_servers: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subnets: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ZoneRedundant { + Enable, + Disable, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/resourcemover/src/package_2021_08_01/operations.rs b/services/mgmt/resourcemover/src/package_2021_08_01/operations.rs new file mode 100644 index 0000000000..6f276331a7 --- /dev/null +++ b/services/mgmt/resourcemover/src/package_2021_08_01/operations.rs @@ -0,0 +1,2054 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::{models, API_VERSION}; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn move_collections(&self) -> move_collections::Client { + move_collections::Client(self.clone()) + } + pub fn move_resources(&self) -> move_resources::Client { + move_resources::Client(self.clone()) + } + pub fn operations_discovery(&self) -> operations_discovery::Client { + operations_discovery::Client(self.clone()) + } + pub fn unresolved_dependencies(&self) -> unresolved_dependencies::Client { + unresolved_dependencies::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + MoveCollections_Get(#[from] move_collections::get::Error), + #[error(transparent)] + MoveCollections_Create(#[from] move_collections::create::Error), + #[error(transparent)] + MoveCollections_Update(#[from] move_collections::update::Error), + #[error(transparent)] + MoveCollections_Delete(#[from] move_collections::delete::Error), + #[error(transparent)] + MoveCollections_Prepare(#[from] move_collections::prepare::Error), + #[error(transparent)] + MoveCollections_InitiateMove(#[from] move_collections::initiate_move::Error), + #[error(transparent)] + MoveCollections_Commit(#[from] move_collections::commit::Error), + #[error(transparent)] + MoveCollections_Discard(#[from] move_collections::discard::Error), + #[error(transparent)] + MoveCollections_ResolveDependencies(#[from] move_collections::resolve_dependencies::Error), + #[error(transparent)] + MoveResources_List(#[from] move_resources::list::Error), + #[error(transparent)] + UnresolvedDependencies_Get(#[from] unresolved_dependencies::get::Error), + #[error(transparent)] + MoveCollections_BulkRemove(#[from] move_collections::bulk_remove::Error), + #[error(transparent)] + MoveResources_Get(#[from] move_resources::get::Error), + #[error(transparent)] + MoveResources_Create(#[from] move_resources::create::Error), + #[error(transparent)] + MoveResources_Delete(#[from] move_resources::delete::Error), + #[error(transparent)] + OperationsDiscovery_Get(#[from] operations_discovery::get::Error), + #[error(transparent)] + MoveCollections_ListMoveCollectionsBySubscription(#[from] move_collections::list_move_collections_by_subscription::Error), + #[error(transparent)] + MoveCollections_ListMoveCollectionsByResourceGroup(#[from] move_collections::list_move_collections_by_resource_group::Error), + #[error(transparent)] + MoveCollections_ListRequiredFor(#[from] move_collections::list_required_for::Error), +} +pub mod move_collections { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + body: None, + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + body: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + } + } + pub fn prepare( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> prepare::Builder { + prepare::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + body: None, + } + } + pub fn initiate_move( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> initiate_move::Builder { + initiate_move::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + body: None, + } + } + pub fn commit( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> commit::Builder { + commit::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + body: None, + } + } + pub fn discard( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> discard::Builder { + discard::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + body: None, + } + } + pub fn resolve_dependencies( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> resolve_dependencies::Builder { + resolve_dependencies::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + } + } + pub fn bulk_remove( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> bulk_remove::Builder { + bulk_remove::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + body: None, + } + } + #[doc = "Get all Move Collections."] + pub fn list_move_collections_by_subscription( + &self, + subscription_id: impl Into, + ) -> list_move_collections_by_subscription::Builder { + list_move_collections_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Get all Move Collections."] + pub fn list_move_collections_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_move_collections_by_resource_group::Builder { + list_move_collections_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_required_for( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + source_id: impl Into, + ) -> list_required_for::Builder { + list_required_for::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + source_id: source_id.into(), + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Created201(models::MoveCollection), + Ok200(models::MoveCollection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod prepare { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/prepare", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod initiate_move { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/initiateMove", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod commit { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/commit", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod discard { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/discard", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod resolve_dependencies { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/resolveDependencies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod bulk_remove { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/bulkRemove", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_move_collections_by_subscription { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Migrate/moveCollections", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveCollectionResultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_move_collections_by_resource_group { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveCollectionResultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_required_for { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) source_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/requiredFor", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let source_id = &self.source_id; + url.query_pairs_mut().append_pair("sourceId", source_id); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RequiredForResourcesCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod move_resources { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + filter: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + move_resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + move_resource_name: move_resource_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + move_resource_name: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + move_resource_name: move_resource_name.into(), + body: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + move_resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + move_resource_name: move_resource_name.into(), + } + } + } + pub mod list { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/moveResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) move_resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/moveResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name, + &self.move_resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::MoveResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) move_resource_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/moveResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name, + &self.move_resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MoveResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::{models, API_VERSION}; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) move_resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/moveResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name, + &self.move_resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod unresolved_dependencies { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + move_collection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + move_collection_name: move_collection_name.into(), + dependency_level: None, + orderby: None, + filter: None, + } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) move_collection_name: String, + pub(crate) dependency_level: Option, + pub(crate) orderby: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn dependency_level(mut self, dependency_level: impl Into) -> Self { + self.dependency_level = Some(dependency_level.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Migrate/moveCollections/{}/unresolvedDependencies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.move_collection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + if let Some(dependency_level) = &self.dependency_level { + url.query_pairs_mut().append_pair("dependencyLevel", dependency_level); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UnresolvedDependencyCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations_discovery { + use super::{models, API_VERSION}; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self) -> get::Builder { + get::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::{models, API_VERSION}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrl(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequest(http::Error), + #[error("Failed to serialize request body: {0}")] + Serialize(serde_json::Error), + #[error("Failed to get access token: {0}")] + GetToken(azure_core::Error), + #[error("Failed to execute request: {0}")] + SendRequest(azure_core::Error), + #[error("Failed to get response bytes: {0}")] + ResponseBytes(azure_core::StreamError), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + Deserialize(serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Migrate/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", super::API_VERSION); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsDiscoveryCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/resources/src/package_resources_2021_01/models.rs b/services/mgmt/resources/src/package_resources_2021_01/models.rs index 62d8c76305..382513f67a 100644 --- a/services/mgmt/resources/src/package_resources_2021_01/models.rs +++ b/services/mgmt/resources/src/package_resources_2021_01/models.rs @@ -572,6 +572,8 @@ pub struct ProviderResourceType { pub api_versions: Vec, #[serde(rename = "defaultApiVersion", default, skip_serializing_if = "Option::is_none")] pub default_api_version: Option, + #[serde(rename = "zoneMappings", default, skip_serializing_if = "Vec::is_empty")] + pub zone_mappings: Vec, #[serde(rename = "apiProfiles", default, skip_serializing_if = "Vec::is_empty")] pub api_profiles: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -884,3 +886,10 @@ pub mod what_if_property_change { NoEffect, } } +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZoneMapping { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} diff --git a/services/mgmt/resources/src/package_resources_2021_04/models.rs b/services/mgmt/resources/src/package_resources_2021_04/models.rs index 0425f87874..4aba606cc3 100644 --- a/services/mgmt/resources/src/package_resources_2021_04/models.rs +++ b/services/mgmt/resources/src/package_resources_2021_04/models.rs @@ -633,6 +633,8 @@ pub struct ProviderResourceType { pub api_versions: Vec, #[serde(rename = "defaultApiVersion", default, skip_serializing_if = "Option::is_none")] pub default_api_version: Option, + #[serde(rename = "zoneMappings", default, skip_serializing_if = "Vec::is_empty")] + pub zone_mappings: Vec, #[serde(rename = "apiProfiles", default, skip_serializing_if = "Vec::is_empty")] pub api_profiles: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -958,3 +960,10 @@ pub mod what_if_property_change { NoEffect, } } +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZoneMapping { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} diff --git a/services/mgmt/securityinsights/Cargo.toml b/services/mgmt/securityinsights/Cargo.toml index fa663bf085..46efd451ee 100644 --- a/services/mgmt/securityinsights/Cargo.toml +++ b/services/mgmt/securityinsights/Cargo.toml @@ -23,6 +23,7 @@ default = ["package-2021-04-01-only", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-version = [] +"package-preview-2021-09" = [] "package-2021-04-01-only" = [] "package-2020-01" = [] "package-2021-03-preview-only" = [] diff --git a/services/mgmt/securityinsights/src/lib.rs b/services/mgmt/securityinsights/src/lib.rs index a6f35bacb3..9c7ebd906c 100644 --- a/services/mgmt/securityinsights/src/lib.rs +++ b/services/mgmt/securityinsights/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-preview-2021-09")] +pub mod package_preview_2021_09; +#[cfg(all(feature = "package-preview-2021-09", not(feature = "no-default-version")))] +pub use package_preview_2021_09::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-04-01-only")] pub mod package_2021_04_01_only; #[cfg(all(feature = "package-2021-04-01-only", not(feature = "no-default-version")))] diff --git a/services/mgmt/securityinsights/src/package_preview_2021_09/mod.rs b/services/mgmt/securityinsights/src/package_preview_2021_09/mod.rs new file mode 100644 index 0000000000..8eb0528b0a --- /dev/null +++ b/services/mgmt/securityinsights/src/package_preview_2021_09/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod operations; +#[allow(dead_code)] +pub const API_VERSION: &str = "2021-09-01-preview"; diff --git a/services/mgmt/securityinsights/src/package_preview_2021_09/models.rs b/services/mgmt/securityinsights/src/package_preview_2021_09/models.rs new file mode 100644 index 0000000000..36c1bf0bb9 --- /dev/null +++ b/services/mgmt/securityinsights/src/package_preview_2021_09/models.rs @@ -0,0 +1,3538 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadCheckRequirements { + #[serde(flatten)] + pub data_connectors_check_requirements: DataConnectorsCheckRequirements, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadCheckRequirementsProperties { + #[serde(flatten)] + pub data_connector_tenant_id: DataConnectorTenantId, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadDataConnector { + #[serde(flatten)] + pub data_connector: DataConnector, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadDataConnectorProperties { + #[serde(flatten)] + pub data_connector_tenant_id: DataConnectorTenantId, + #[serde(flatten)] + pub data_connector_with_alerts_properties: DataConnectorWithAlertsProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AatpCheckRequirements { + #[serde(flatten)] + pub data_connectors_check_requirements: DataConnectorsCheckRequirements, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AatpCheckRequirementsProperties { + #[serde(flatten)] + pub data_connector_tenant_id: DataConnectorTenantId, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AatpDataConnector { + #[serde(flatten)] + pub data_connector: DataConnector, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AatpDataConnectorProperties { + #[serde(flatten)] + pub data_connector_tenant_id: DataConnectorTenantId, + #[serde(flatten)] + pub data_connector_with_alerts_properties: DataConnectorWithAlertsProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AscCheckRequirements { + #[serde(flatten)] + pub data_connectors_check_requirements: DataConnectorsCheckRequirements, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AscCheckRequirementsProperties { + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AscDataConnector { + #[serde(flatten)] + pub data_connector: DataConnector, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AscDataConnectorProperties { + #[serde(flatten)] + pub data_connector_with_alerts_properties: DataConnectorWithAlertsProperties, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionPropertiesBase { + #[serde(rename = "logicAppResourceId")] + pub logic_app_resource_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionRequest { + #[serde(flatten)] + pub resource_with_etag: ResourceWithEtag, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionRequestProperties { + #[serde(flatten)] + pub action_properties_base: ActionPropertiesBase, + #[serde(rename = "triggerUri")] + pub trigger_uri: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionResponse { + #[serde(flatten)] + pub resource_with_etag: ResourceWithEtag, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionResponseProperties { + #[serde(flatten)] + pub action_properties_base: ActionPropertiesBase, + #[serde(rename = "workflowId", default, skip_serializing_if = "Option::is_none")] + pub workflow_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionsList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityCustomEntityQuery { + #[serde(flatten)] + pub custom_entity_query: CustomEntityQuery, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityEntityQueriesProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "queryDefinitions", default, skip_serializing_if = "Option::is_none")] + pub query_definitions: Option, + #[serde(rename = "inputEntityType", default, skip_serializing_if = "Option::is_none")] + pub input_entity_type: Option, + #[serde(rename = "requiredInputFieldsSets", default, skip_serializing_if = "Vec::is_empty")] + pub required_input_fields_sets: Vec>, + #[serde(rename = "entitiesFilter", default, skip_serializing_if = "Option::is_none")] + pub entities_filter: Option, + #[serde(rename = "templateName", default, skip_serializing_if = "Option::is_none")] + pub template_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "createdTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub created_time_utc: Option, + #[serde(rename = "lastModifiedTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_modified_time_utc: Option, +} +pub mod activity_entity_queries_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct QueryDefinitions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityEntityQuery { + #[serde(flatten)] + pub entity_query: EntityQuery, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityEntityQueryTemplate { + #[serde(flatten)] + pub entity_query_template: EntityQueryTemplate, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityEntityQueryTemplateProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "queryDefinitions", default, skip_serializing_if = "Option::is_none")] + pub query_definitions: Option, + #[serde(rename = "dataTypes", default, skip_serializing_if = "Vec::is_empty")] + pub data_types: Vec, + #[serde(rename = "inputEntityType", default, skip_serializing_if = "Option::is_none")] + pub input_entity_type: Option, + #[serde(rename = "requiredInputFieldsSets", default, skip_serializing_if = "Vec::is_empty")] + pub required_input_fields_sets: Vec>, + #[serde(rename = "entitiesFilter", default, skip_serializing_if = "Option::is_none")] + pub entities_filter: Option, +} +pub mod activity_entity_query_template_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct QueryDefinitions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[serde(rename = "summarizeBy", default, skip_serializing_if = "Option::is_none")] + pub summarize_by: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityTimelineItem { + #[serde(flatten)] + pub entity_timeline_item: EntityTimelineItem, + #[serde(rename = "queryId")] + pub query_id: String, + #[serde(rename = "bucketStartTimeUTC")] + pub bucket_start_time_utc: String, + #[serde(rename = "bucketEndTimeUTC")] + pub bucket_end_time_utc: String, + #[serde(rename = "firstActivityTimeUTC")] + pub first_activity_time_utc: String, + #[serde(rename = "lastActivityTimeUTC")] + pub last_activity_time_utc: String, + pub content: String, + pub title: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertDetailsOverride { + #[serde(rename = "alertDisplayNameFormat", default, skip_serializing_if = "Option::is_none")] + pub alert_display_name_format: Option, + #[serde(rename = "alertDescriptionFormat", default, skip_serializing_if = "Option::is_none")] + pub alert_description_format: Option, + #[serde(rename = "alertTacticsColumnName", default, skip_serializing_if = "Option::is_none")] + pub alert_tactics_column_name: Option, + #[serde(rename = "alertSeverityColumnName", default, skip_serializing_if = "Option::is_none")] + pub alert_severity_column_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRule { + #[serde(flatten)] + pub resource_with_etag: ResourceWithEtag, + pub kind: AlertRuleKindEnum, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AlertRuleKindEnum { + Scheduled, + MicrosoftSecurityIncidentCreation, + Fusion, + #[serde(rename = "MLBehaviorAnalytics")] + MlBehaviorAnalytics, + ThreatIntelligence, + #[serde(rename = "NRT")] + Nrt, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleTemplate { + #[serde(flatten)] + pub resource: Resource, + pub kind: AlertRuleKindEnum, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleTemplateDataSource { + #[serde(rename = "connectorId", default, skip_serializing_if = "Option::is_none")] + pub connector_id: Option, + #[serde(rename = "dataTypes", default, skip_serializing_if = "Vec::is_empty")] + pub data_types: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleTemplatePropertiesBase { + #[serde(rename = "alertRulesCreatedByTemplateCount", default, skip_serializing_if = "Option::is_none")] + pub alert_rules_created_by_template_count: Option, + #[serde(rename = "lastUpdatedDateUTC", default, skip_serializing_if = "Option::is_none")] + pub last_updated_date_utc: Option, + #[serde(rename = "createdDateUTC", default, skip_serializing_if = "Option::is_none")] + pub created_date_utc: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "requiredDataConnectors", default, skip_serializing_if = "Vec::is_empty")] + pub required_data_connectors: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod alert_rule_template_properties_base { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Installed, + Available, + NotAvailable, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRuleTemplatesList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AlertRuleTriggerOperator { + GreaterThan, + LessThan, + Equal, + NotEqual, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertRulesList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AlertSeverityEnum { + High, + Medium, + Low, + Informational, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AlertsDataTypeOfDataConnector { + pub alerts: DataConnectorDataTypeCommon, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Anomalies { + #[serde(flatten)] + pub settings: Settings, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AnomaliesSettingsProperties { + #[serde(rename = "isEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_enabled: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiPollingParameters { + #[serde(rename = "connectorUiConfig", default, skip_serializing_if = "Option::is_none")] + pub connector_ui_config: Option, + #[serde(rename = "pollingConfig", default, skip_serializing_if = "Option::is_none")] + pub polling_config: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AttackTactic { + InitialAccess, + Execution, + Persistence, + PrivilegeEscalation, + DefenseEvasion, + CredentialAccess, + Discovery, + LateralMovement, + Collection, + Exfiltration, + CommandAndControl, + Impact, + PreAttack, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRule { + #[serde(flatten)] + pub resource_with_etag: ResourceWithEtag, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRuleAction { + pub order: i32, + #[serde(rename = "actionType")] + pub action_type: automation_rule_action::ActionType, +} +pub mod automation_rule_action { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + ModifyProperties, + RunPlaybook, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRuleCondition { + #[serde(rename = "conditionType")] + pub condition_type: automation_rule_condition::ConditionType, +} +pub mod automation_rule_condition { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConditionType { + Property, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRuleModifyPropertiesAction { + #[serde(flatten)] + pub automation_rule_action: AutomationRuleAction, + #[serde(rename = "actionConfiguration")] + pub action_configuration: automation_rule_modify_properties_action::ActionConfiguration, +} +pub mod automation_rule_modify_properties_action { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ActionConfiguration { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub classification: Option, + #[serde(rename = "classificationComment", default, skip_serializing_if = "Option::is_none")] + pub classification_comment: Option, + #[serde(rename = "classificationReason", default, skip_serializing_if = "Option::is_none")] + pub classification_reason: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub labels: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub owner: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRuleProperties { + #[serde(rename = "displayName")] + pub display_name: String, + pub order: i32, + #[serde(rename = "triggeringLogic")] + pub triggering_logic: AutomationRuleTriggeringLogic, + pub actions: Vec, + #[serde(rename = "createdTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub created_time_utc: Option, + #[serde(rename = "lastModifiedTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_modified_time_utc: Option, + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AutomationRulePropertyConditionSupportedProperty { + IncidentTitle, + IncidentDescription, + IncidentSeverity, + IncidentStatus, + IncidentTactics, + IncidentRelatedAnalyticRuleIds, + IncidentProviderName, + AccountAadTenantId, + AccountAadUserId, + AccountName, + #[serde(rename = "AccountNTDomain")] + AccountNtDomain, + #[serde(rename = "AccountPUID")] + AccountPuid, + AccountSid, + AccountObjectGuid, + #[serde(rename = "AccountUPNSuffix")] + AccountUpnSuffix, + AzureResourceResourceId, + AzureResourceSubscriptionId, + CloudApplicationAppId, + CloudApplicationAppName, + #[serde(rename = "DNSDomainName")] + DnsDomainName, + FileDirectory, + FileName, + FileHashValue, + #[serde(rename = "HostAzureID")] + HostAzureId, + HostName, + HostNetBiosName, + #[serde(rename = "HostNTDomain")] + HostNtDomain, + #[serde(rename = "HostOSVersion")] + HostOsVersion, + IoTDeviceId, + IoTDeviceName, + IoTDeviceType, + IoTDeviceVendor, + IoTDeviceModel, + IoTDeviceOperatingSystem, + #[serde(rename = "IPAddress")] + IpAddress, + MailboxDisplayName, + MailboxPrimaryAddress, + #[serde(rename = "MailboxUPN")] + MailboxUpn, + MailMessageDeliveryAction, + MailMessageDeliveryLocation, + MailMessageRecipient, + #[serde(rename = "MailMessageSenderIP")] + MailMessageSenderIp, + MailMessageSubject, + MailMessageP1Sender, + MailMessageP2Sender, + MalwareCategory, + MalwareName, + ProcessCommandLine, + ProcessId, + RegistryKey, + RegistryValueData, + Url, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRulePropertyValuesCondition { + #[serde(flatten)] + pub automation_rule_condition: AutomationRuleCondition, + #[serde(rename = "conditionProperties")] + pub condition_properties: automation_rule_property_values_condition::ConditionProperties, +} +pub mod automation_rule_property_values_condition { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ConditionProperties { + #[serde(rename = "propertyName", default, skip_serializing_if = "Option::is_none")] + pub property_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operator: Option, + #[serde(rename = "propertyValues", default, skip_serializing_if = "Vec::is_empty")] + pub property_values: Vec, + } + pub mod condition_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Equals, + NotEquals, + Contains, + NotContains, + StartsWith, + NotStartsWith, + EndsWith, + NotEndsWith, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRuleRunPlaybookAction { + #[serde(flatten)] + pub automation_rule_action: AutomationRuleAction, + #[serde(rename = "actionConfiguration")] + pub action_configuration: automation_rule_run_playbook_action::ActionConfiguration, +} +pub mod automation_rule_run_playbook_action { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct ActionConfiguration { + #[serde(rename = "logicAppResourceId", default, skip_serializing_if = "Option::is_none")] + pub logic_app_resource_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRuleTriggeringLogic { + #[serde(rename = "isEnabled")] + pub is_enabled: bool, + #[serde(rename = "expirationTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub expiration_time_utc: Option, + #[serde(rename = "triggersOn")] + pub triggers_on: automation_rule_triggering_logic::TriggersOn, + #[serde(rename = "triggersWhen")] + pub triggers_when: automation_rule_triggering_logic::TriggersWhen, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub conditions: Vec, +} +pub mod automation_rule_triggering_logic { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggersOn { + Incidents, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggersWhen { + Created, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRulesList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Availability { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "isPreview", default, skip_serializing_if = "Option::is_none")] + pub is_preview: Option, +} +pub mod availability { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status {} +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AwsCloudTrailCheckRequirements { + #[serde(flatten)] + pub data_connectors_check_requirements: DataConnectorsCheckRequirements, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AwsCloudTrailDataConnector { + #[serde(flatten)] + pub data_connector: DataConnector, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AwsCloudTrailDataConnectorDataTypes { + pub logs: serde_json::Value, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AwsCloudTrailDataConnectorProperties { + #[serde(rename = "awsRoleArn", default, skip_serializing_if = "Option::is_none")] + pub aws_role_arn: Option, + #[serde(rename = "dataTypes")] + pub data_types: AwsCloudTrailDataConnectorDataTypes, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AwsS3CheckRequirements { + #[serde(flatten)] + pub data_connectors_check_requirements: DataConnectorsCheckRequirements, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AwsS3DataConnector { + #[serde(flatten)] + pub data_connector: DataConnector, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AwsS3DataConnectorDataTypes { + pub logs: serde_json::Value, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AwsS3DataConnectorProperties { + #[serde(rename = "destinationTable")] + pub destination_table: String, + #[serde(rename = "sqsUrls")] + pub sqs_urls: Vec, + #[serde(rename = "roleArn")] + pub role_arn: String, + #[serde(rename = "dataTypes")] + pub data_types: AwsS3DataConnectorDataTypes, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Bookmark { + #[serde(flatten)] + pub resource_with_etag: ResourceWithEtag, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BookmarkExpandParameters { + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "expansionId", default, skip_serializing_if = "Option::is_none")] + pub expansion_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BookmarkExpandResponse { + #[serde(rename = "metaData", default, skip_serializing_if = "Option::is_none")] + pub meta_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +pub mod bookmark_expand_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Value { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub entities: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub edges: Vec, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BookmarkList { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BookmarkProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "displayName")] + pub display_name: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub labels: Vec